I created a button with an attribute named "loaded" and the initial value is "no." After clicking the button, I start some ajax, and at the very end I try to set the loaded attribute to yes so that ajax does not start again if the user clicks the button more than once.
I have something like this: http://jsfiddle.net/PDW35/2/
Pressing the button does not switch to yes. However, if you run the warning immediately after calling .attr as follows:
alert($(this).attr('loaded'));
the warning field contains βyesβ, which does not help, because as soon as the user clicks, the same code displays a βnoβ warning.
Everything behaves the same if I use .prop instead of .attr. Am I missing a point here or is .prop and .attr just not working with custom attributes?
EDIT: Updated jsfiddle using ajax, based on the comments below: http://jsfiddle.net/PDW35/5/
source share