3
I’m Making an answer validation application for a particular question, I need that when the <input type="checkbox">
is selected if an attribute is addedbox-shadow
to <textarea>
of reply.
What I tried to do in Jquery had no effect on the form.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
if ($("input.correta").is(":checked")) {
$(this).closest("textarea").css("box-shadow", "1px 1px 10px #0c6f00");
} else {
$(this).closest("textarea").css("box-shadow", "none");
}
});
</script>
html code
<div class='form-group respostas' id='resposta1'>
<div class='row form-control'>
<div class='span8'>
<textarea style='resize:none' class='span8' rows='3' placeholder="1º Resposta" maxlength='255' id='resposta1'></textarea>
</div>
</div>
<span class='help-block text-right'>
<label class='btn btn-success'>
<input type='checkbox' style='margin-top:0px' class="correta" name='resposta' value='resposta1'> Marcar como Correta
</label>
</span></div>
recalling that to work in all browsers, important insert -Webkit-box-shadow and -Moz-box-shadow:
– Leonardo Assunção