javascript - How to bind click event on image added using CSS 'background-image' property in jQuery -
here fiddle link
i guess question clear title itself. still, looking way bind click
event on image added using css's background-image
property.
i know, have achieved similar functionality (of placing image on input field using this way or this way) positioning <img>
tag on input
box , handling required events way didn't seem flexible input fields of varying width , height or if wrapping div doesn't have position:relative;
property.
if adding event on image loaded background-image
not possible how make later approach more flexible.
hope have conveyed issues clearly.
thanks.
something appears work:
$('.cross').click(function(e) { var mouseposinelement = e.pagex - $(this).position().left; if (mouseposinelement > $(this).width()) { $(this).val(''); } });
Comments
Post a Comment