How, using jQuery, might I obtain the src attribute of a HTML img element? -
The mouse cursor runs on an image, I would like to display a warning ()
that image The value of the src
attribute of
You can use this event.
If you have
& lt; Img src = 'foo.jpg' id = 'bar' & gt;
You may have some jQuery code such as
$ ('# bar'). Mouseover (function () {warning ($ (this) .attr ('src'));});
(If this fails, you would replace $ (this)
in place of $ ('# bar')
Try it, but as noted, it is very ugly in the comment)
EDIT: missed the need to show the src attribute for the first time ..
Comments
Post a Comment