<script type='text/javascript' href='jquery.js'></script>
<script>
$(document).ready(function(){
$('.selects').change(function(){
$('.select').
})
});
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!doctype HTML>
<input type='radio' id ='index1' value='1' name='radio1' disabled>radio button 1</input><br><br>
<select class='select' data-value='1'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
</select><br><br>
<input type='radio' id ='index2' value='2' name='radio2' disabled>radio button 2</input><br><br>
<select class='select' data-value='2'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
</select><br><br>
Run codeHow to remove a disabled property from a switch when selecting a menu?
<!doctype HTML>
<?php
$x = 1;
$y = 1;
while($x <= 2){
echo "<input type='radio' id ='index$x' value='$x' name='radio$x' disabled>radio button $x</input><br><br>";
echo "<select class='select' data-value='$x'>";
while($y<= 4){
echo "<option>$y</option>";
$y++;
}
echo "</select><br><br>";
$x++;
$y = 1;
}
?>
<script type='text/javascript' href='jquery-2.1.4.min.js'></script>
<script>
$(document).ready(function(){
$('.select').change(function(){
var sel = $(this).attr('data-value');
var selVal = $(this).val();
if(selVal >= 3){
$('#index'+sel).prop('disabled', false);
}
});
});
</script>
When the value of the selection menu parameter reaches a value of 3 or higher, the disabled property from the switch will change to false. I also tried this script below:
<script>
$(document).ready(function(){
$('.select').change(function(){
var sel = $(this).attr('data-value');
if($( ".select option:selected" ) >= 3){
$('#index'+sel).prop('disabled', false);
}
});
});
</script>
I saw a typo in my code at href='jquery-2.1.4.min/js'. I tried replacing it but still not working. I got a console error. Unused ReferenceError: $ is not defined on line 6, which$(document).ready(function(){
EDITED: provided a fragment of the stack converted to html
source
share