Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Trouble responding to a button click

Posted on 2011-09-27
2
Medium Priority
?
179 Views
Last Modified: 2012-05-12
I have a button defined called myButton. I created this:

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

What's wrong?
0
Comment
Question by:newbieweb
2 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 36713917
<< 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
 

Author Closing Comment

by:newbieweb
ID: 36713927
Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question