How to set css via jquery for preventing some action

Tags: jquery,css

Problem :

Please refer the below link.

CSS rule to disable text selection highlighting

The above link is useful to disable selection while dragging. code snippet.

.unselectable {
  -moz-user-select: none;
  -khtml-user-select: none;
  -webkit-user-select: none;
  user-select: none;

but i don't want to use css concept here. i want to set these attributes for particular element via jquery. how can i do this ?



Solution :

You can use it like this

           -moz-user-select: none;
           -khtml-user-select: none;
           -webkit-user-select: none;
           user-select: none;

It is better to use class though

Your css class:

       -moz-user-select: none;
       -khtml-user-select: none;
       -webkit-user-select: none;
       user-select: none;

Your Jquery command


    CSS Howto..

    how to change browsers default scrollbar using css or jquery

    How to set css class on active menu item using a masterpage?

    How to distribute cell height evenly within a row spanning two cells vertically?

    How to center a navigation bar properly? [closed]

    How to align a HTML definition list (
    ) horizontally without limiting term or definition in height?

    How to keep symmetry with CSS fluid spacing of dynamic content

    CSS InfoBox over all elements how to place? [closed]

    How to fix the Height for this area?

    Sencha Touch 2: how to remove right arrow of datepickerfield by using css?

    How to change overlay whole div by an image via CSS

    How to create a “dot-dash” border with css or javascript?

    How do I style an upload input using CSS?

    How to get the value of css property with jQuery

    How can I implement this dual-gradient menu design?

    How to center an iframe, responsive

    How to centre a table in html using css file? [duplicate]

    Some doubts about how make an image clickable using CSS

    How to avoid css overlapping?

    jQuery Accordion header with jQuery UI icon button (hide/show + hover/click)

    How do I change the a border-color on rollover?

    How to show red border at Invalid Input Box after clicking Submit button with angularjs

    CSS: How to create a
  • with 100% width
  • How to Set an if in css for opera browser? [duplicate]

    How to display sub sub menu to the left side using CSS?

    How to use scrollRevealJS alongside AnimateCSS?

    How to make a automatic image slider.?

    How to align TH Header with TD in TBody

    Show image when hovering on a span

    How to size images loaded from other users such that dimensions are maintained yet a max width and height are set with css? (HTML/JS/CSS)

    CSS: how to get two floating divs inside another div