I have the following
$().ready(function() {
$("input[name^=totalRent_]").each(function()
{ var input = $(this);
var name = input.attr('name');
var num = /\d+$/.exec(name)[0];
My html form has:
<input type="text" name="totalRent_1" value="" /> <br />
<input type="hidden" name="totalRent_1_hidden" /><br />
<hr />
<input type="text" name="totalRent_2" value="" /> <br />
<input type="hidden" name="totalRent_2_hidden" /><br />
<hr />
<input type="text" name="totalRent_3" value="" /> <br />
<input type="hidden" name="totalRent_3_hidden" /><br />
<hr />
Now, I get a javascript error saying: /\d+$/.exec(name) is null
The each function is attached to ("input[name^=totalRent_]"). What do I need to do so that in's only attached to total_rent and not with totalRent_..._hidden ?
Thanks in advance.