I have a scenario where, when I check Bills Available checkbox, a Image Upload camera function should pop-up. I can write the came function for "Image Upload" later. But i need "Image Upload" displayed when I check "Bills Available"
function calc()
{
var update=false;
console.log("update is" + update);
}
<td><input class="pop" id="exp" type="checkbox" name="bill available" value="" onchange="calc();"/>Bill available<br></td>
Like this:
window.onload = function() {
document.getElementById("exp").onclick = function() {
document.getElementById('upload').className = this.checked ? '' : 'hide';
}
}
window.onload = function() { document.getElementById("exp").onclick = function() { document.getElementById('upload').className = this.checked ? '' : 'hide'; } }
.hide { display: none }
<input class="pop" id="exp" type="checkbox" name="bill_available" value="" /><label for="exp">Bill available</label> <div class="hide" id="upload">Upload</div>
Using your code after cleaning it up:
window.onload = function() { document.getElementById("exp").onclick = function() { document.getElementById('upload').className = this.checked ? '' : 'hide'; } }
.hide { display: none }
<table> <tr> <td> <input class="pop" id="exp" type="checkbox" name="bill_available" value="" /> <label for="exp">Bill available</label> </td> <td class="hide" id="upload"> <img id="p2" src="./images/camera 40.PNG" style="width:30px;height:30px;" onclick="window.location='4s.html'" /><b>Image Upload</b> </td> </tr> </table>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.