Dynamically inserting javascript with Jquery doesn't work -
i'm trying append on body's html js librarys jquery, because have code:
<!doctype html> <html> <head> <script src="/scripts/jquery-1.8.1.min.js" type="text/javascript"></script> <script src="/chatjs/scripts/jquery.zambachat.js" type="text/javascript"></script> <script src="/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="/scripts/jquery.signalr-1.1.2.min.js"></script> <script src="/signalr/hubs" type="text/javascript"></script> <script src="/chatjs/scripts/jquery.chatjs.signalradapter.js" type="text/javascript"></script> <script src="/chatjs/scripts/jquery.autosize.min.js" type="text/javascript"></script> <script src="/chatjs/scripts/jquery.activity-indicator-1.0.0.min.js" type="text/javascript"></script> <script src="/chatjs/scripts/jquery.chatjs.js" type="text/javascript"></script> <script src="/scripts/scripts.js" type="text/javascript"></script> <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script> </head> </html>
and want have this:
<!doctype html> <html> <head> <script src="/scripts/jquery-1.8.1.min.js" type="text/javascript"></script> <script src="/chatjs/scripts/jquery.zambachat.js" type="text/javascript"></script> </head> </html>
i'm putin reference of js in "jquery.zambachat.js" tried code seen in internet. have code, in file each js. try append dont work.
(function ($) { $.getscript("/bootstrap/js/bootstrap.min.js", function () { alert("running js"); }); var s = document.createelement("script"); s.type = "text/javascript"; s.src = "c:\users\starerdoc\desktop\zamreachat\samples\chatjsmvcsample\chatjs\scripts\bootstrap\js\bootstrap.min.js"; $("head").append(s);
//and code $('head').append(''); })(jquery); if try append style css like
$('head').append('<link rel="stylesheet" type="text/css" href="/bootstrap/css/bootstrap-responsive.min.css" />');
its work's ok, not js. im using chrome thanks.
Comments
Post a Comment