i created an appendScript function that will be called in the event with the click of a button. My functional code
function appendScript() {var v_js; var head= document.getElementsByTagName('head')[0]; v_js = document.createElement('script'); v_js.type = 'text/javascript'; v_js.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'; head.appendChild(v_js); var body = document.getElementsByTagName('body')[0]; v_js =document.createElement('script'); v_js.type="text/javascript" ; v_js.src = "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js"; body.appendChild(v_js); var v_css= document.createElement('link'); v_css.rel= "stylesheet"; v_css.type = "text/css" ; v_css.href="http://twitter.imtqy.com/bootstrap/1.4.0/bootstrap.min.css" body.appendChild(v_css); }
when i click the button i get an error
Uncaught TypeError: Object [object Object] has no method 'on' bootstrap.min.js:6 (anonymous function) bootstrap.min.js:6 (anonymous function)
can anyone help how to solve this error?
source share