jquery - Get a tag that's inside a div with class -
i have following html:
<div class="checkbox"> <img src='../tema/default/images/checkverde.png' onclick="visibilidade('41767', 'img08ptna_41767_0', '10')" style='cursor:pointer;margin: 4px;text-align:center;' id='img08ptna_41767_0' /> </div> i need src value of img tag, via jquery. img id dynamic
how can ?
$(".checkbox img").prop("src");
will work based on provided html. of course, if have multiple div elements or multiple images inside div, may have use eq() method getting value index.
for example:
$(".checkbox:eq(0) img").prop("src"); - first div.checkbox image source.
keep in mind if there multiple images inside of selector, .prop() methods returns value of first 1 - http://api.jquery.com/prop/
Comments
Post a Comment