I couldn't find anything, but I feel like it's been asked before.
I have multiple inputs:
<input id="id1" class="abc" name="tags" "value="test1" />
<input id="id2" class="abc" name="tags" "value="test2" />
When the user changes the value of the input, I want the script to pick it up and assign it into an array.
What I have:
jQuery('.abc').change(function() {
var id = jQuery(this).attr('id');
var name = jQuery(this).attr('name');
var value = jQuery(this).val();
var ch = {};
ch[id][name] = value;
alert(ch[id][name]);
});
But from the start, it didn't work. jQuery(this).attr('id') doesn't exist as a function. I think the reason this isn't working is because there isn't a specific class I am calling, but I don't know. Maybe I've been staring at code too much, but it's not working!
the error: can't convert undefined to object
chdefined?chdefined?