JQuery: How to remove css border property from my div?

I am trying to remove a div border, but no luck. I commented on the code in my css and this is the correct property that I want to remove. Here is the code I'm currently using. Changing the background color works in the code below, but removeClass does not work.

var tab = getURLParameter("tab"); // Disable the visual style of the button since it is disabled for this page. if (tab == "Property") { $(".scrape-button").css('background-color', '#efefef'); $(".scrape-button:hover").removeClass('border'); } 

Any ideas? Thanks!

+4
source share
5 answers

The jQuery selector with the hover pseudo-class has no effect, because there is no element on the page with the hover state. I recommend you try another aproach

 <script> var tab = getURLParameter("tab"); if (tab == "Property") { $(".scrape-button").addClass("disabled") } </script> <style> .disabled { background-color: #EFEFEF; } .disabled:hover { border: none; } </style> 
+5
source

Just remove the css property as follows:

 $(".scrape-button:hover").css('border',''); 

.removeClass() used to remove the declared css class from the element.

+8
source
 $('.scrape-button:hover').css('border', 'none'); 

try it

+1
source

There is no pseudo-class : hover in jQuery.

try it

 $('.scrape-button').hover(function() { $(this).removeClass('border') }, function() { $(this).addClass('border') });​ 

Check FIDDLE

+1
source

Try it if you use a class -

 $(".scrape-button:hover").attr('class',''); 
+1
source

Source: https://habr.com/ru/post/1436641/


All Articles