You need to sign in to do that
Don't have an account?
ksmo
when checkbox is checked show popup and whne unchecked show different popup
I want the dialog popup to display only when the checkbox is checked, but this code displys when checked and unchecked. I want a different pop up for uncheck..How do I write that script?
checkbox code
<input id="showprompt" type="checkbox" name="CO_BRAND" value="cobrand" onclick="ShowPrompt()" />
Javascript Code
<script>
var checkmodal = document.getElementById('checkboxModal');
var btn = document.getElementById("showprompt");
var span = document.getElementsByClassName("checkboxclose")[0];
function ShowPrompt()
{
checkmodal.style.display = "block";
}
span.onclick = function() {
checkmodal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
checkmodal.style.display = "none";
}
}
checkbox code
<input id="showprompt" type="checkbox" name="CO_BRAND" value="cobrand" onclick="ShowPrompt()" />
Javascript Code
<script>
var checkmodal = document.getElementById('checkboxModal');
var btn = document.getElementById("showprompt");
var span = document.getElementsByClassName("checkboxclose")[0];
function ShowPrompt()
{
checkmodal.style.display = "block";
}
span.onclick = function() {
checkmodal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
checkmodal.style.display = "none";
}
}
All Answers
Vivek Shinde
It worked!
<input id="showprompt" type="checkbox" name="Name" value="Name"onclick="ShowPrompt(this.checked)" />
function ShowPrompt(isChecked) {
if(isChecked==true){
}
}
<input id="showprompt" type="checkbox" name="Name" value="Name "onclick="if({!item.name='test'),ShowPrompt(this.checked)" />
I want the correct syntax