1

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>
2
  • Please indent your script. Also include URL to the plugin easySlider you are using. Commented May 26, 2009 at 13:26
  • cssglobe.com/post/4004/… Commented May 26, 2009 at 13:30

3 Answers 3

2
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

Sign up to request clarification or add additional context in comments.

Comments

1

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

But i have included jQuery in my script can it be something else ?
I've copied the essential parts of your code into JSBin here: jsbin.com/aribe/edit and it seems to be working fine. I'd suggest re-examining your code to make sure there's no silly mistakes anywhere. Also, try using "jQuery()" instead of "$()"
1

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 ;)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.