There is nothing wrong with your pageinit event. The <a> tag is incorrect.
To remove the error you get, you need to make two changes to your code:
- Its not
disabled , its disable - before calling the
disable method, you must call the button() method. That way you would initialize the button element.
Here's what the code looks like now:
$('#ageNext').button().button('disable');
But if you do this, you will get an error message:
Uncaught TypeError: unable to call addClass method from undefined
The applicant lies in the code that calls the disable method
disable: function() { this.element.attr( "disabled", true ); this.button.addClass( "ui-disabled" ).attr( "aria-disabled", true );
Do you see this.button there? This will become undefined if the item is not a real button.
So, I have disable to work only with the element type input[type=button] and <button/> . For some reason, this does not work as expected on the <a/> buttons. I have this to work by manually adding the ui-disabled class to the element, for example:
$(document).on('pageinit', '#age', function (e) { $('#ageNext').addClass('ui-disabled'); });
Demo: http://jsfiddle.net/hungerpain/gzAHT/
krishgopinath
source share