Share On Twitter Facebook Google+ LinkedIn Pinterest Tumblr Reddit
Question

jquery doesnt work

Tags: html jquery javascript
Date:
Status:Resolved
Question Id:12

Guys, is it a mistake in the codes? When you click on the input with the id ahmet in jquery, I said "I succeeded" to the screen, but it did not work.
codes in html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
  "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
  <title>Mehmet Acar - Kişisel Web Site</title>
  <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
	<script src="jqueryn.js"></script>

 </head>
 <body>

<input type="submit" id="ahmet" value="Gönder" />

</body>
</html>

All code inside jquery no other code except this
$("input#ahmet").click(function(){
  alert("Başardım");
});



Answer
Date:
Correct:No

Are you sure your djs file is named "jqueryn.js"?

Answer
Date:
Correct:No

I am sure. There is only the code written there in the jquery file. There is no other code.

Answer
Date:
Correct:No

You have to write the code in the document.ready function or at the end of the body.

Answer
Date:
Correct:Yes

like this: 

$(document).ready(function(){
$("input#ahmet").click(function(){
alert("Başardım");
});
});

Answer
Date:
Correct:Yes

there are two methods:

$(document).ready(function(){codes});
$(window).load(function(){codes });

Answer
Date:
Correct:No

Thank you. That's work.

Your Answer

Review Your Answer