include - Including jquery in .js file -
i trying clone object using
var newobject = jquery.extend(true, {}, oldobject);
as per john resig's answer what efficient way deep clone object in javascript? .
all information can find on using libraries in javascript show how use library within html file... in:
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
my code in .js file , error jquery not defined. how use jquery within .js file?
edit: i'm running code in server.js file on node server. server.js has event handler gives index.html file upon getting "/" url. server.js file isn't included in index.html file , therefore including jquery in html file doesn't me, if understanding correct.
you can't include or link within .js file. have include on html page (<script src="/path/to/jquery"></script>
), before include .js file.
technically could copy , paste jquery code above code in .js file, better idea include on page avoid conflicts.
Comments
Post a Comment