Response title
This is preview!
$(function() {
$(".category_select").change(function() {
if(( $('option:selected', this).text() =='Active' )){
console.log('Active')
}else{console.log('Deactivated')}
});
});
if(( $('option:selected', this).text() =='Active' ))
It’s considered bad form to use the text because it could have been translated by chrome or other.
$(".category_select").on("change",".edit_cat", function() {
var deactivated=$(this).val()==="active"
if(deactivated == true){
$(".category_alert").html(' Message One ').addClass("alert alert-info alert-dismissible") }
else{$(".category_alert").html('Message Two ').addClass("alert alert-danger alert-dismissible");
}
})
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
© 2013 jQuery Foundation
Sponsored by and others.