I'm trying to find an element by it's data-id and data-type so I can do stuff with it, but I'm finding an error when doing so.. Here's my function:
find : function(id, type) {
$('.elem').each(function(index, element) {
if ($(this).data('id') == id && $(this).data('type') == type)
return $(this);
});
},
What I try to do for example is:
myClass.find(1, 'myType').text('whatever');
How can I do this?
EDIT: Thanks to adeneo and user3558931! Modified to:
findPro : function(id, type) {
return $('.elem[data-id=' + id + '][data-type=' + type + ']');
},