I'm doing an answer validation application for a given question, I need to add a <input type="checkbox">
to box-shadow
attribute of the answer when <textarea>
is selected.
What I tried to do in JQuery did not have an 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>