Skip to main content

jQuery Alert: Different Ways jQuery.Alert() Can Be Used

By Sam Deering



Free JavaScript Book!

Write powerful, clean and maintainable JavaScript.

RRP $11.95

What is .alert()

Sometimes you need to go back to basics and use the .alert() function in jQuery to see what a variable is or check if your JavaScript is actually working at all. Probably one of the most underated functions, but certainly the most used, is jquery.Alert(). Also known as a jQuery command box or system popup window, jQuery alerts contain text information displayed to the user.

How to use .alert()

//when the webpage is loaded
jQuery(document).ready(function($) {
alert("js is working");

Other variations:

// or
// also try

If the last one doesn’t work (it should alert ‘HTMLElement’, depending on the browser) then jQuery is not working, you might need to check your imports are correct or check for errors in your JavaScript files.

Related Articles

Sam Deering has 15+ years of programming and website development experience. He was a website consultant at Console, ABC News, Flight Centre, Sapient Nitro, and the QLD Government and runs a tech blog with over 1 million views per month. Currently, Sam is the Founder of Crypto News, Australia.

New books out now!

Learn the basics of programming with the web's most popular language - JavaScript

A practical guide to leading radical innovation and growth.

Integromat Tower Ad