1
I am trying to generate events from the user action in a checkbox list. The idea is simple: Manage the appearance of "Divs" content on the screen from the ". toogle()" jquery checkbox in html.
The method works for other input elements, such as text input (type="text"), but not in the checkbox.
NOTE: I am Using HTML, CSS3, BOOTSRAP and JQUERY to make the screen
But to simplify the solution, I intend to ask your team to only generate an "Alert" command when the user marks or deselects a checkbox, using javascript or jQuery.
//JQUERY/JS - OPÇÃO 1
function teste(){
alert("foi !");
}
if($("#selecionado").is(':checked')){
teste();
}
//JQUERY/JS - OPÇÃO 2
x= $("#selecionado").prop( "checked");
$("#selecionado").change(
function(){
if(x==true){
alert("merda");
}
}
);
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<div class="col-lg-8">
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox" id="selecionado" class="chk-services"/>
</span>
<label type="text" class="form-control label-form" >
<strong>PRICING</strong> - Valorização de Instrumentos Financeiros
</label>
</div>
</div>
Great, it worked! Thank you very much!
– Fred Chehuan
Cool! Look at this link the best way to thank. Abs!
– Sam