How to display display none as important using jquery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • user7777
    New Member
    • Sep 2014
    • 6

    How to display display none as important using jquery

    I have a div which is display block (getting the style through jquery) and now I want to make it display none when the user click on it only for the tablet and mobile view. So I used attr('style','d isplay: none !important'). But it is taking display block as default. Is there any solution to overcome this.....
  • Exequiel
    Contributor
    • Jul 2012
    • 288

    #2
    $('yourdiv').li ve('click', function(ev) {
    $(this).hide("f ast");
    // or $(this).css({"d isplay":"none"} );
    });

    Comment

    • user7777
      New Member
      • Sep 2014
      • 6

      #3
      Hi Exequiel I used both the methods suggested by you but unfortunately both are returning the same output as before.

      This is my code.....

      Code:
      if(windowWidth < 769) {
      						self.page.on("click",".addonUncheck",function(){
      							$('.singleAddon').attr('style','display: none !important');
      						});
      						self.page.on("click",".deleteAddon",function(){
      							$('#single_addon').show();
      						});
      					}
      For desktop view the div is displayed as display: block using jquery now want to make it display: none only for mobile and tablet view... Any suggestions...

      Comment

      Working...