I am appending some HTML to a doc. Part of the HTML is a text input. When I enter info in this input, I want to update the value of the closest li
's data value.
Currently this isn't working. However, if I change the data('name'..) to CSS it works. I have checked that the value is being assigned, and it is.
Any ideas why this isn't working? Thanks in advance.
$(document).on('keyup','.image-name', function() {
var value = $(this).val();
$(this).closest('li.image').data('name', value);
}).keyup();