Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
36
rated 0 times [  38] [ 2]  / answers: 1 / hits: 79635  / 11 Years ago, tue, october 8, 2013, 12:00:00

I'm new to jQuery. I want to use a button click event to raise an alert box. This is my code, but it doesn't seem to work.


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Jquery Basic</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('submit1').click(function() {
alert("JQuery Running!");
)};
});
</script>
</head>
<body>
<a>JQuery Test Page</a><br>
<input id="submit1" type="button" value="Submit"/>
</body>
</html>

More From » jquery

 Answers
10

You are missing the # from your id selector. Try this:



$(document).ready(function(){
$('#submit1').click(function(){
alert(JQuery Running!);
});
});

[#75152] Monday, October 7, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
makaylahk

Total Points: 166
Total Questions: 94
Total Answers: 117

Location: Gabon
Member since Sat, Jul 25, 2020
4 Years ago
;