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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -