The code block that I tried to remove disabled attribute from a select menu returns my checkbox validation as true. How do I properly remove the disabled property without messing up my validation?
while($row = mysqli_fetch_assoc($query)){
echo "<h5><input class='check' panel-menu='menu$index'
type='checkbox' name='roomType[]' id='roomType[$index]'
value='".$row['roomDetailsNo']."'> Choose this Room";
echo "<br>Number of Rooms: ";
echo "<select id='menu$index' name='noOfRooms[".$row['roomDetailsNo']."][]' disabled>";
$rooms = 0;
while($rooms <= $row['available_rooms']){
echo "<option>";
echo $rooms;
echo "</option>";
$rooms++;
}
echo "</select><br>";
}
here's my jquery
<script>
$(function(){
$('#btn').on('click', function(){
var check = $("input:checked").length;
if(check <= 0){
alert("Please Choose a Room");
return false;
}
else{
$('.check').on('click', function{
var check = $(this).attr('panel-menu');
checkbox = $('#'+check).is(':checked');
if(checkbox){
$('#'+check).prop('disabled', false);
alert("checked");
}
});
return true;
}
});
});
</script>