Solved

Trouble responding to a button click

Posted on 2011-09-27
2
165 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 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
<< 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
Comment Utility
Thanks!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Angular JS question 24 37
dynamics crm 2011 - Web Resources 1 23
JavaScript Scope issue 4 17
Re-position the objects 7 46
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now