Skip to main content
CSS-Tricks
  • Articles
  • Videos
  • Almanac
  • Newsletter
  • Guides
  • DigitalOcean
  • DO Community
Search
Code Snippets → JavaScript → Basic Alert

Basic Alert

Avatar of Chris Coyier
Chris Coyier on Sep 11, 2009
<script type="text/javascript">
       alert('ALERT!')
</script>
Psst! Create a DigitalOcean account and get $200 in free credit for cloud-based hosting and services.

Comments

  1. Dhaval
    Permalink to comment# May 18, 2010

    This is very nice as a designer i have to find some where else and not get proper way for alert

    thanks

    Reply
  2. TutorialsFor
    Permalink to comment# May 10, 2012

    Will this alert on by clicking or on page load ?

    Reply
    • noob coder
      Permalink to comment# April 18, 2016

      yes, on default it will alert on DOM load/ready

  3. Julia
    Permalink to comment# October 13, 2012

    Wonderful, I was looking everywhere on the internet since hours to know how to do such a thing, now I’m gunna do that on all my website page !!

    But I still have a question though, is it possible to change the message ALERT! into something else, like HELLO! or something ?

    Thanks for your help !

    Reply
    • Elijah
      Permalink to comment# November 12, 2012

      Julia, yes you can. You just edit the “ALERT!” to whatever you want it to be.

  4. Reem
    Permalink to comment# November 18, 2012

    it is very easy please upload more examples so i can clear the concept

    Reply
  5. Oria
    Permalink to comment# June 29, 2015

    Here’s a simple non-modal replacement for the alert:

    Reply
  6. Oria
    Permalink to comment# June 29, 2015

    Here’s a simple non-modal replacement for the alert function:

    Reply
  7. megatron
    Permalink to comment# April 26, 2016

    Most basic thing ever…most front end developers use a custom light box or modal box

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

CSS-Tricks is powered by DigitalOcean.

Keep up to date on web dev

with our hand-crafted newsletter

DigitalOcean
  • DigitalOcean
  • DigitalOcean Community
  • About DigitalOcean
  • Legal
  • Free Credit Offer
CSS-Tricks
  • Email
  • Guest Writing
  • Book
  • Advertising
Follow
  • Mastodon
  • Twitter
  • Instagram
  • YouTube
  • CodePen
  • iTunes
  • RSS
Back to Top