I am getting this error while using twitter bootstrap. I didn't get this error when using it in html. I converted it into a wordpress theme, and now i am getting this error.
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-dropdown.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$('.dropdown-toggle').dropdown()
</script>
I am getting these errors.
any help is much appreciated. thanks.
edit: i tried this https://stackoverflow.com/a/9301017/759257
and included the latest jquery version 1.7.1 and now it works!!
The undefined property indicates that a variable has not been assigned a value, or not declared at all.
You may experience the “jQuery is not defined error” when jQuery is included but not loaded. Make sure that it's loaded by finding the script source and pasting the URL in a new browser or tab. The snippet of text you should look for to find the URL to test.
Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong to objects. Since undefined is not an object type, calling a function or a property on such a variable causes the TypeError: Cannot read property of undefined .
You're loading the scripts in the wrong order. Load jQuery first, otherwise it won't be available for the bootstrap script.
You're not setting it in the right order:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-dropdown.js"></script>
<script type="text/javascript">
$('.dropdown-toggle').dropdown();
</script>
I assume the "bootstrap-dropdown.js" file is a jQuery plugin. If that's the case, you need to load jQuery first, so switch your <script>
tags around.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With