www.webdeveloper.com
Results 1 to 5 of 5

Thread: alert box

  1. #1
    Join Date
    Jun 2013
    Posts
    20

    alert box

    Hello guys,

    Im learning javascript and for a website, i need a button and when on clicked, it should give an alert popup. The button that wil be used has the ID = place.

    This is the code i have in the <script></script>.

    $("#place").click(function(){
    alert("Your order has been placed. We will constantly update your delivery status by email.");
    });


    When i press the button, nothing happens. Any idea?

    Would be great if someone else could help me with this!

    Thanks!
    Reckimo

  2. #2
    Join Date
    Oct 2013
    Posts
    490
    Since you are using JQuery and not Javascript, have you called a jQuery library? Won't work without it.

    Alternatively:
    Code:
    <button id="place" onclick="alert('Your order has been placed. We will constantly update your delivery status by email.')"> Click Me </button>

  3. #3
    Join Date
    Jun 2013
    Posts
    20
    Hi Kevin,

    Thanks for your answer. And yes, i do have a library. Normally it should work, but it down work. When i copy your alternatively code and place it in the body, when i launch it in the browser and i press on the button you have created, still nothing happens. Any idea?

    thanks

  4. #4
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,648
    any idea about checking for errors and letting the others know? 'nothing happens' is not a javascript error
    xxx: Guess Buddhist riddle: "What is the sound of one hand clapping?"
    yyy: facepalm

  5. #5
    Join Date
    Oct 2013
    Posts
    490
    Guaranteed to work:
    Code:
    <!DOCTYPE html>
    <html lang="en">
        <head>
    	<meta charset="utf-8" />
    	<title>Alert button</title>
        </head>
    
    <body>
    
        <button id="place" onclick="alert('Your order has been placed. We will constantly update your delivery status by email.')"> Click Me </button>
    
    </body>
    
    </html>
    If it doesn't you have something else going on.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles