Question

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>
Was it helpful?

Solution

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

OTHER TIPS

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top