Problem Description
How does the meaning in class="errorMessage active"HTML Code
<span class="errorMessage active">Invalid</span>
CSS Code and why the .active after the .errorMesage
.errorMessage{
display: none;
color: red;
margin-left: 10px;
}
.errorMessage.active {
display: inline-block;
border: 1px solid #e6e6e6;
padding: 0 5px;
background: #ffdae0;
border-radius: 3px;
}
Jquery code
$('.IncludeSnRNA').on('change', function(){
if($(this).is(":checked")){
$('.errorMessage').addClass("active");
$('.IncludeSnRNA').val('t');
}else {
$('.errorMessage').removeClass("active");
$('.IncludeSnRNA').val('f');
}
});
Solution
It is the Combinations of Classes and IDs
Target an element that has all of multiple classes
and means the active class of errorMessage class is use as constraint to that the subject is errorMessage
沒有留言:
張貼留言