Change border-bottom color using jQuery? Change border-bottom color using jQuery? jquery jquery

Change border-bottom color using jQuery?


$("selector").css("border-bottom-color", "#fff");
  1. construct your jQuery object which provides callable methods first. In this case, say you got an #mydiv, then $("#mydiv")
  2. call the .css() method provided by jQuery to modify specified object's css property values.


$('#elementid').css('border-bottom', 'solid 1px red');


to modify more css property values, you may use css object. such as:

hilight_css = {"border-bottom-color":"red",                "background-color":"#000"};$(".msg").css(hilight_css);

but if the modification code is bloated. you should consider the approach March suggested. do it this way:

first, in your css file:

.hilight { border-bottom-color:red; background-color:#000; }.msg { /* something to make it notifiable */ }

second, in your js code:

$(".msg").addClass("hilight");// to bring message block to normal$(".hilight").removeClass("hilight");

if ie 6 is not an issue, you can chain these classes to have more specific selectors.