Search This Blog

Friday, November 6, 2015

How to tab key press values passes textbox1 to textbox2 in jQuery?


<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
function textonlyEmpName(e, obj) {
try{

var code;
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code);
var AllowRegex = /^[ba-zA-Zs-]$/;
if (AllowRegex.test(character)) {

var firstName = $.trim($("#TxtEmpFirstName").val());
var MedileName = $.trim($("#txtEmpMiddleName").val());
var lastName = $.trim($("#TxtEmpLastName").val());
var FullName = $("#txtEmpFullName");
if (firstName != "") {

FullName.val(firstName + " " + MedileName + " " + lastName);
}
} else {
return false;
}
}
catch(e)

alert(""+e);
}
}</script>
<div class="row">

EmpFirstName<span style="color: red">*</span>
<input type="text" ID="TxtEmpFirstName"MaxLength="20"
onkeyup="return textonlyEmpName(event,this);"></input>

EmpLastName<span style="color: red">*</span>
<input type="text" ID="TxtEmpLastName" MaxLength="20"
onkeyup="return textonlyEmpName(event,this);"></input>

EmpMiddleName
<input type="text" ID="txtEmpMiddleName" MaxLength="20"
onkeyup="return textonlyEmpName(event,this);"></input>

EmpFullName
<input type="text" ID="txtEmpFullName" MaxLength="60"
onkeypress="return false" onkeydown="return false"
onmousewheel="return false" onmousedown="return false"
onmouseup="return false" onkeyup="return false"></input>
</div>

No comments:

Post a Comment