HTML
<input type="number" id="progress-update-1234" class="progress-update" data-entryid="1234" data-updateItem="progress" value="3" min="1" max="15" />
jQuery
$( ".progress-update" ).change(function() {
var entry_id = this.$.attr('data-entryid');
var item_entry = this.$.attr('data-updateItem');
var new_progress = $("#progress-update-" + entry_id).val();
alert( "This is progress update" + entry_id + " and type " + item_entry + " and new progres " + new_progress );
});
I'm not exactly sure why this is returning an error: Cannot call method 'attr' of undefined
in the console. I am using this
inside the change
function that is attached to the right class. Why am I getting this error?