Adrien Lafond
Adrien Lafond

Reputation: 63

How to Select a price with jQuery or Regex within a span?

How to select the price value (here 79,90) within a span tag ?

<span name="data_udpade_minicard">2\&nbsp; article(s)<br>79,90 €</span>

I tried by stripping out the beggining with Regex:

$('span').text().replace(/.*article\(s\)/,"");

the result is

"2  79,90 €"

Upvotes: 0

Views: 103

Answers (1)

Alok Pathak
Alok Pathak

Reputation: 875

Try this

var b =$($("span").children('br').get(0).nextSibling);
alert(b.text());

Upvotes: 1

Related Questions