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
Post a Comment