Rafał Developer
Rafał Developer

Reputation: 2055

Import Text from span

How get this text via each loop?

 $('input[id^="ctl00_PlaceHolderMain_subElems2223_repSubElems_ct"]').each(function () { });

how get this value?

enter image description here

This not work

enter image description here

This also not work
enter image description here

Important

If I will write this I will get this value but underlined part is all the time different

enter image description here

Upvotes: 1

Views: 163

Answers (4)

Muhammed Shevil KP
Muhammed Shevil KP

Reputation: 1396

try this

$('[id*="hiddenSpanData"]').each(function () { });

Upvotes: 1

Cláudio Barreira
Cláudio Barreira

Reputation: 459

Try like this:

var spanText = $('this').next("span#content").text();

Upvotes: 2

Pranav C Balan
Pranav C Balan

Reputation: 115242

Parse the value content then get element using find()

$('input[id^="ctl00_PlaceHolderMain_subElems2223_repSubElems_ct"]').each(function () { 
   var text = $(this.value).find('span#content').text();
});

Upvotes: 1

Adil
Adil

Reputation: 148160

You are trying to get the span in html you have in input type hidden. So first get the html using .val() on hidden field. After that you can get the span. You can assign html to some div to find span in its descendants.

$('<div></div>').text($('input[id^="ctl00_PlaceHolderMain_subElems2223_repSubElems_ct"]')
.val()).find('span').eq(1).text();

Upvotes: 1

Related Questions