I've been dealing with this problem and need help to match exactly what I intend for. I'm learning jquery and cannot get it right :(
I'm making dynamic textboxes and give an id in this format:
id = "addBox" + row + "_" + num;
row and num are variables passed by the function. row is dynamic so can go from 1 to 20.
Per every row I can have multiple textbooxes and that's the reason for num.
When I want to select how many nums are in that row I put a variable counter to give me that value as follows:
var counter = $("input[id^='addBox"+row"']").length;
If row is less than 10 works perfect, but the problem is that
this matches: row = "1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19".
How can I put a more strict selector where only matches that row?
I want to know how many "num" are in that row.
var counter = $("input[id^='addBox"+row"']:first").length; matches the row but not the num.