Sunday, December 18, 2011

Unselectable javascript Text

Making text un selectable is a cross-browser method for preventing text selection using this attr  .The no IE  browsers  also support this using some CSS.Here is the simple java script function it makes the controls in the page are unselected in IE browser
if($.browser.msie) {
this._mouseUnselectable=this.element.attr('unselectable');
this.element.attr('unselectable','on');
}
this.started=false;
}

If u want restore the text selection in IE the follow in java script can be helpful to allow selection in IE.I have used this script for allow the text selection in my jquery function
($.browser.msie
&& this.element.attr('unselectable', this._mouseUnselectable));
}

No comments:

Bel