I have a problem with a javascript error: $("#slider") is undefined
How can i solve this problem?
<script type="text/javascript">
$(document).ready(function() {
$("#slider").easySlider({
controlsBefore: '<p id="controls">',
controlsAfter: '</p>',
prevId: 'prevBtn',
nextId: 'nextBtn'
});
});
</script>
This is my html
<div id='slider'>
<table>
<tr>
<td width='325'>hello</td>
<td width='325'>hello</td>
</table>
</div>
-
Please indent your script. Also include URL to the plugin easySlider you are using.Svante Svenson– Svante Svenson2009年05月26日 13:26:33 +00:00Commented May 26, 2009 at 13:26
-
cssglobe.com/post/4004/…djairo– djairo2009年05月26日 13:30:15 +00:00Commented May 26, 2009 at 13:30
3 Answers 3
jQuery(document).ready(function() {
jQuery("#slider").easySlider({
controlsBefore: '<p id="controls">',
controlsAfter: '</p>',
prevId: 'prevBtn',
nextId: 'nextBtn'
});
});
Probebly you got more then 1 jQuery script try this script if it work you have to change the order of script use
Comments
I doubt there's a problem in the code you've pasted here -- even if you wrote something like this:
$('bladkhadlhadkjha').easySlider({ ... });
You wouldn't be getting the "undefined" error, since jQuery would handle that gracefully. Make sure that jQuery is being included properly, your plugin is being included properly and that the code you've pasted is exactly the code you're having the problem with.
2 Comments
try:
$(document).ready(function(){
alert("jquery is working");
});
if this dont make a alert pop up your problem is in the link to jquery. I hope it helps ;)