I have a
Term ID: <input type="text" name="data_array[term_id]" size="5" value="' . $highest_term_id . '">
$("input[data_array[" + index + "][term_id]").val((index + 1));
Error: Syntax error, unrecognized expression:
var index = 0;
The square bracket has special meaning in jQuery selectors - you'll have to escape them - should be something like:
$("input[name=data_array\\[" + index + "\\]\\[term_id\\]]").val((index + 1));
I'd try to avoid this naming convention if possible, or try to find an alternative to selecting it by name - as you can see, it's hard to keep the brackets and backslashes straight when referencing it.