jquery - Find prev element source -
i know code below doesn't work, possible call "src"
prev, <img>
with little tweak jquery below?
html:
<li> <img src="assets/themes/abstract/1_tbn.png" class="theme_tbn" /> <label class="theme_label">diffuse green</label> <span> <button class="btn-publish choosetheme">choose theme</button> </span> </li>
jquery:
$(".choosetheme").click(function () { var src = $(".choosetheme").find("img"); alert(src.text()); });
$(".choosetheme").click(function () { var src = $(this).closest('li').find("img").attr('src'); alert(src); });
Comments
Post a Comment