I am trying to get a variable number out of a text in the below example is the text.
Koop 5 voor € 16,00 p/s en bespaar 11%
Koop 50 voor € 15,00 p/s en bespaar 17%
Koop 120 voor € 13,00 p/s en bespaar 28%
Koop 1000 voor € 10,00 p/s en bespaar 45%
This means Buy X for $Y each and save Z%
I need X out of this text with jQuery or Javascript.
Below is the code, to get the text out of the A tag
$(function(){
$('.link').click(function() {
$("#input-field").val($(this).html());
});
});
and the example a tags and input field:
<input id="input-field" type="text">
<a href="#" class="link">koop 10 voor 10 p.s.<a>
<a href="#" class="link">koop 110 voor 9 p.s<a>
<a href="#" class="link">koop 950 voor 7 p.s<a>