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

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -