I added a fake attribute to all my elements on the page, for example myId=100, each element has a different fake id.
Now i need to find an element according to the fake id, is this possible?
I tried doing
$("#myFrame").contents().find('a').each(function () {
if ($(this).attr['myid'] === 100) {
$(this).hide();
}
});
Any better ideas?
thank you
$(this).attr['myid']should be$(this).attr('myid')(attris a function).You can also use the attribute selector:
You should avoid adding custom attributes to HTML elements. If you explain the problem we might be able to suggest a better way.