Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Simpley jQuery - Not working

Posted on 2012-08-21
1
Medium Priority
?
300 Views
Last Modified: 2012-08-21
Ok, Ive been given this code which isnt working, and cannot for the life of me figure out the issue:-

<html>
<head>
<title>Title</title>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
</head>
<body>

<script type="text/javascript">
	$("#target").click(function() {
		alert("Handler for .click() called.");
	});
</script>

<div id="target">Click here</div>

</body>
</html>

Open in new window


There are no errors being displayed, and I have redownloaded the jquery-1.8.0.min.js to confirm thats ok.

Any ideas???? :-S

Thank you
0
Comment
Question by:tonelm54
1 Comment
 
LVL 3

Accepted Solution

by:
Maximus5684 earned 2000 total points
ID: 38318288
Wrap your jQuery code in:

$(document).ready(function() {
...
})

Open in new window

0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
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
Course of the Month15 days, 5 hours left to enroll

578 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