javascript - Uncaught ReferenceError: $ is not defined -
i trying create google gadget should built on javascript.every google gadget create iframe element.due constraints can't add jquery directly script tag.i have include using javascript write code
function addscript(jsrelativeurl) { var rebasedurl = rebaserelativeurl(jsrelativeurl,true); var x = document.createelement('script'); x.type='"text/javascript"'; x.src='"'+rebasedurl+'"'; if(x.src.indexof('scripts/jquery-1.9.1.min.js')>=0) document.head.appendchild(x) else document.body.appendchild(x); }
i first calling function
gadgets.util.registeronloadhandler(function(){ addscript('scripts/jquery-1.9.1.min.js'); $(function (){}); });
but giving me error
uncaught referenceerror: $ not defined
and when see in elements jquery included in head tag of iframe . can 1 please why getting error , how getrid of ??
you appending script
tag load jquery @ end of either head
or body
of embedding document. if code executing situated before location of jquery import tag (eg. in script
section of head
or - if appended end of body
- in script
section within body
), cannot present.
Comments
Post a Comment