<select id="month"> <option></option> //data fetch from db </select> <input type="checkbox" id="curr" name="pre" onclick="preCheck()" value="present" <?php if($row['exit'] == "present"){ echo "checked"; }else{ echo "unchecked"; } ?> >
function preCheck(){ var curr= document.getElementById('curr'); if (curr.checked){ document.getElementById("month").setAttribute("disabled", "disabled"); }else{ document.getElementById("month").removeAttribute("disabled"); } }
echo "<script> preCheck(); </script>" ; // that will add this line of JS code to the page to be send, // and at page load at client side, the function involved will fire.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)