Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
188
rated 0 times [  194] [ 6]  / answers: 1 / hits: 52804  / 13 Years ago, thu, september 1, 2011, 12:00:00

Why does the $('#select_embed') property get set to true, but not to false? Instead, I tried removeAttribute('required'), but that didn't work either.



<script>

function showBundles(){
if (document.getElementById(embed).checked){
$('#div_embed_bundles').show('fast')
$('#select_embed').prop('required',true);
}
else {
$('#div_embed_bundles').hide('fast')
$('#select_embed').prop('required',false);
}
}

</script>

More From » jquery

 Answers
35

Ideally if prop('required',true) is working then prop('required',false) should also work. But you can try with removeAttr, hope this helps.



function showBundles(){
if (document.getElementById(embed).checked){
$('#div_embed_bundles').show('fast')
$('#select_embed').prop('required',true);
}
else {
$('#div_embed_bundles').hide('fast')
$('#select_embed').removeAttr('required');
}
}

[#90321] Tuesday, August 30, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
devlin

Total Points: 474
Total Questions: 113
Total Answers: 100

Location: Sweden
Member since Fri, Apr 16, 2021
3 Years ago
;