1st field code:
<li><label class="desc" id="title1">First Name <span class="req" id="req_4">*</span></label>
<div><input name="fname" class="inputwidth" id="fname" type="text" placeholder="First Name" data-nl-bindto="xpath" data-nl-xpath="@firstName" data-nl-ismandatory="true" data-nl-label="First Name" /></div>
</li>
2nd field code:
<li><label class="desc" id="title1">First Name <span class="req" id="req_4">*</span></label>
<div class="inputwidth"><input name="fname2" class="fname2" id="fname2" type="text" placeholder="First Name" data-nl-bindto="xpath" data-nl-xpath="@firstName2" data-nl-ismandatory="true" data-nl-label="First Name" /></div>
</li>
Mirroring script:
$("#mirror").change(function() {
var checkbox = document.getElementById('mirror').checked ;
if(checkbox = true){
var Pfirstname = document.getElementById("fname").value;
var Afirstname = Pfirstname;
document.getElementById("fname2").value = Afirstname;
}
else
{
document.getElementById("fname2").value = '';
}
});