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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -