Trouble responding to a button click

I have a button defined called myButton. I created this:

$("myButton").click( function (e) {
   alert("button clicked");
});

What's wrong?
newbiewebSr. Software EngineerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
leakim971Connect With a Mentor PluritechnicianCommented:
<< called >> ?

ID attribute? <input id="myButton" type="button">
$("[b]#[/b]myButton").click( function (e) {
   alert("button clicked");
});

Open in new window


Name attribute? <input name="myButton" type="button">
$(":button[name='myButton']").click( function (e) {
   alert("button clicked");
});

Open in new window

0
 
newbiewebSr. Software EngineerAuthor Commented:
Thanks!
0
All Courses

From novice to tech pro — start learning today.