javascript - How to get specific span's value from div in JQuery -
i have div , want text of specific span div. following div code:
'<div class="dvdynamic_' + pid + '"><p hidden="true">'+pid+'</p><span class="count_' + pid + '">' + count + '</span><span id="pname" style = "margin-left:70px;">' + pname + '</span><span id="punitprice" style = "margin-left:150px;">' + uprice + '</span></div>'
and want text of following span:
<span class="count_' + pid + '">' + count + '</span>
please me how .
the span element want target have next sibling id. can target element using id selector , traverse required span using .prev()
:
$('#pname').prev().text()
Comments
Post a Comment