what i want to do is that, i want to hold the value of the checkbox(original state) and then on checkbox state change check if the state is not original state then show a textarea.
what i have done till now
<script>
var status = $('#status').val();
$(document).ready(function() {
status = $('#status').is(":checked");
$('#status').on('click', function() {
if( $('#status').is(":checked")!=status){
$('#mandatory').html('*');
}else{
alert("else");
$('#mandatory').html('');
}
});
});
</script>
problem i am facing is that it is not comparing two values.
Aucun commentaire:
Enregistrer un commentaire