i want to detect the the checkbox is checked or not and i successfully does this now if user uncheck it then how can i detech this? my code is this
window.updated = function() {
var x = document.getElementById("new").checked;
if(x=true)
{
alert("true");
}
else
{
var tw1 = document.getElementById('tw1');
tw1.value = '';
document.getElementById('tw1').readOnly=false;
//2nd
tw2 = document.getElementById('tw2');
tw2.value = '';
document.getElementById('tw2').readOnly=false;
//3rd
tw3 = document.getElementById('tw3');
tw3.value = '';
document.getElementById('tw3').readOnly=false;
//4th
tw4 = document.getElementById('tw4');
tw4.value = '';
document.getElementById('tw4').readOnly=false;
//5th
tw5 = document.getElementById('tw5');
tw6.value = '';
document.getElementById('tw5').readOnly=false;
//6th
tw6 = document.getElementById('tw6');
tw6.value = '';
document.getElementById('tw6').readOnly=false;
//7th
tw7 = document.getElementById('tw7');
tw7.value = '';
document.getElementById('tw7').readOnly=false;
}
var ne1 = document.getElementById('ne1'),
tw1 = document.getElementById('tw1');
tw1.value = ne1.value;
document.getElementById('tw1').readOnly=true
//2nd
var ne2 = document.getElementById('ne2'),
tw2 = document.getElementById('tw2');
tw2.value = ne2.value;
document.getElementById('tw2').readOnly=true
//3rd
var ne3 = document.getElementById('ne3'),
tw3 = document.getElementById('tw3');
tw3.value = ne3.value;
document.getElementById('tw3').readOnly=true
//4th
var ne4 = document.getElementById('ne4'),
tw4 = document.getElementById('tw4');
tw4.value = ne4.value;
document.getElementById('tw4').readOnly=true
//5th
var ne5 = document.getElementById('ne5'),
tw5 = document.getElementById('tw5');
tw5.value = ne5.value;
document.getElementById('tw5').readOnly=true
//6th
var ne6 = document.getElementById('ne6'),
tw6 = document.getElementById('tw6');
tw6.value = ne6.value;
document.getElementById('tw6').readOnly=true
//7th
var ne7 = document.getElementById('ne7'),
tw7 = document.getElementById('tw7');
tw7.value = ne7.value;
document.getElementById('tw7').readOnly=true
}
If you check a checkbox it puts the data from the billing info inputs into the shipping info inputs.
However, I always get true
after unchecking the checkbox as well.