Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery: How do I remove a css border property from my div?

I'm trying to remove the border of a div, but no luck. I've commented out the code in my css and it is the correct property that I want to remove. Here is the code I'm using currently. The background-color change is working that's in the code below but the removeClass is not.

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!

like image 748
daveomcd Avatar asked Sep 27 '12 15:09

daveomcd


3 Answers

Just remove the css property like this:

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

.removeClass() is used for removing a declared css class from element.

like image 163
Adriano Carneiro Avatar answered Sep 30 '22 18:09

Adriano Carneiro


The jQuery selector with hover pseudo class has no effect because there is no element in the page with hover state. I recommend you to try a different aproach

<script>
  var tab = getURLParameter("tab");

  if (tab == "Property") {
    $(".scrape-button").addClass("disabled")
  }
</script>
<style>
  .disabled {
    background-color: #EFEFEF;
  }

  .disabled:hover {
    border: none;
  }
</style>
like image 40
coolxeo Avatar answered Sep 30 '22 19:09

coolxeo


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

Try this

like image 20
SNAG Avatar answered Sep 30 '22 17:09

SNAG