javascript - Set image in an input value -


i trying include img tag inside input's value attribute. using jquery:

<input type="text" value="lorem impsum <img src='...'/>" /> 

i tried this:

jquery(document).ready(function() {       productinput = jquery('input[value=product]');      productinput.val(data.selecteddata.value + '<img style="width:128px" src="' + data.selecteddata.imagesrc + '" />'); });      

but it's not working. so, know how can this?

note: image inside value.

you can set image putting image background of element

for example

html

<input type="text" value="lorem impsum" class="default" /> 

css

input.default{        background: url('../images/any.jpg') 0 0 no-repeat;     } 

you can set css of element using jquery on document ready.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -