The following code works in all browsers apart from IE6…
var mylib =
{
selectStyle :
{
init : function()
{
$('#select-box1').jqTransform({imgPath:'jqtransformplugin/img/'});
}
}
}
<script type="text/javascript">
mylib.selectStyle.init();
</script>
The error states ‘mylib’ is undefined
Can someone please help otherwise I will have to spend alot of time redoing a lot more code than this.
Many thanks,
C
Add a semicolon at the end of the definition of mylib.
When declaring anything in
var something = ...;always add a semicolon at the end.Thank you IE, you are so wonderful, reminding us to put semicolons. (Sarcasm? maybe…)
Edit: The semicolon is not a recommendation, IE considers it an error if you don’t put it after closing curly brackets, so if you declare a function in a var, put the semicolon too.
var myFunc = function(){ .... };.But if you declare a function in the namespace, you don’t need to add the semicolon.
function doSomething(){ ... }<– no semicolon.