javascript - Load image in DIV from url obtained from a TEXT BOX -
i trying t load image div tag url obtained textbox.my current file follows..i don't know else done
<html lang="en"> <head> </head> <body> <input type="text" class="imageurl1"> <div class="imagecontainer"> image appear here: </div> </body> </html>
how using button call funtion that'll change image src url in text box
html
<html lang="en"> <head> </head> <body> <input type="text" class="imageurl1"> <button onclick="func()">load image</button> <div class="imagecontainer"> <img src="" id="imgcontainer"> </div> </body> </html>
javascript
(function(){ var func = function(){ var url = $(".imageurl1").val() $('#imgcontainer').attr('src',url) } })();
here's jsfiddle with jquery , without jquery
Comments
Post a Comment