I have complex input elements of type text with names like product[1][combinations][x][price]. There are many of this element, differing in name only by the value after [combinations] and after [x].
For example:
product[1][price]
product[1][combinations][x][price]
product[1][combinations][xx][price]
product[1][combinations][xxx][price]
product[1][combinations][xxxx][price]
product[1][sale_price]
product[1][combinations][x][sale_price]
product[1][combinations][xx][sale_price]
product[1][combinations][xxx][sale_price]
product[1][combinations][xxxx][sale_price]
product[2][price]
product[2][combinations][a][price]
product[2][combinations][aa][price]
product[2][combinations][aaa][price]
product[2][combinations][aaaa][price]
product[2][sale_price]
product[2][combinations][a][sale_price]
product[2][combinations][aa][sale_price]
product[2][combinations][aaa][sale_price]
product[2][combinations][aaaa][sale_price]
the above values x, xx, xxx, xxxx and a, aa, aaa, aaaa represent unique values per product[id]. the first definition in each group(product[2][sale_price] for example) represents the parent or owner product who's value i will be batch updating to its children(combinations).
I would like to find groups of these elements based on what the type of information is being stored, for example sale_price and then change its value. I don't need to consider the unique value, [x] so i hoped i could use a wildcard.
I hoped something like this would solve the problem(example):
$("input[name='product[1][combinations][*][price]'][type='text']").val(0);
however the * isn't really a wildcard i guess, so i can't use it like that.
I realize i could do something like this, however this will assign 0 to all inputs instead of just sale_price:
$("input[name^='product[1][combinations]'][type='text']").val(0);
How can i replace this($("input[name='product[1][combinations][*][price]'][type='text']").val(0);) selector with an appropriate wild card? I'd like to keep the name array values in the same order if possible