Disable anchors in Chrome/WebKit/Safari?

I assume that you have an onclick event handler bound to these anchor elements. Just have your event handler check the "disabled" attribute and cancel the event if it is set. Your event handler would look something like this.

Up vote 4 down vote favorite 4 share g+ share fb share tw.

Consider the following code: $("a"). Attr("disabled", "disabled"); In IE and FF, this will make anchors unclickable, but in WebKit based browsers (Google Chrome and Safari) this does nothing. The nice thing about the disabled attribute is that it is easily removed and does not effect the href and onclick attributes.

Do you have any suggestions on how to get the desired result. Answers must be: Easily be revertable, since I want to disable form input controls while I have an AJAX call running. Must work in IE, FF, and WebKit jquery html safari google-chrome webkit link|improve this question edited Oct 6 '08 at 17:20Lou Franco35.2k64183 asked Oct 6 '08 at 17:01Stefan Rusek1,60711017 100% accept rate.

I assume that you have an onclick event handler bound to these anchor elements. Just have your event handler check the "disabled" attribute and cancel the event if it is set. Your event handler would look something like this: $("a").

Click(function(event){ if (this. Disabled) { event.preventDefault(); } else { // make your AJAX call or whatever else you want } }); You can also set a stylesheet rule to change the cursor. Adisabled=disabled { cursor: wait; } Edit - simplified the "disabled" check as suggested in comments.

Function diableForms() { $("input, button, textarea, a"). Attr("disabled", "disabled"). Css("cursor", "wait"); } function enableForms() { $("input, button, textarea, a").

Not(". Disabled"). RemoveAttr("disabled").

Css("cursor", ""); } – Stefan Rusek Oct 6 '08 at 18:22 I just pasted the disableForms and enableForms functions I am using. Thanks for your suggestion. – Stefan Rusek Oct 6 '08 at 18:24 if(this.

Disabled == "disabled") will be quicker – Sugendran Oct 7 '08 at 4:39 actually I think it's if(this. Disabled) - I really should check my comments before I write them – Sugendran Oct 7 '08 at 4:39 if(this. Disabled) is what I used.

I don't have enough karma to edit posts or I would add some of this too Neall's post – Stefan Rusek Oct 10 '08 at 10:37.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions