javascript - how to display and image using external jquery in my html file -
I'm new to jquery, someone can tell me how to display and using external jquery in my html file Image.
I should clean my HTML and load the image where the image path is mentioned in the outer path.
My jquery file will be like this testjquery.js
and in my html file.
& lt; Html & gt; & Lt; Top & gt; & Lt; Script type = "text / javascript" & gt; (Function () {var test = document.createElement ('script'); test.type = 'text / javascript'; test.async = true; test.src = 'testquery.js'; var s = document.getElementsByTagName ( 'Script') [0]; s.parentNode.insertBefore (test, s); test.onload = function () {// function to load external image}}) (); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; / Body & gt; & Lt; / Html & gt;
Thank you in advance!
You can just use:
HTML
& lt; Div id = "divWhereYouWantAddImage" & gt; & Lt; / Div & gt;
JQUERY
$ ('# divWhereYouWantAddImage'). Attachment ("& lt; img src = 'img.jpg' / & gt;");
You can read more about the jquery
.append () function.
Comments
Post a Comment