.clsspan
{
background-color:#f4f4f4;
color:GrayText;
}
$(document).ready(function () {
// assign if not null
if ($("#interestrate").val() != "")
{ $("#spaninterestrate").innerHTML = $("#interestrate").val(); }
$("#spaninterestrate").focus(function () {
editready(this);
});
$("#spaninterestrate").keyup(function () {
validateOBj(this);
});
$("#spaninterestrate").blur(function () {
CheckSpan(this);
});
});
function CheckSpan(obj) {
if (obj.innerHTML == "") {
obj.innerHTML = "Edit Text";
return false;
}
else { }
}
//validation function for Format
function validateOBj(obj) {
var objvalue = obj.innerHTML;
var valid = /^\d{0,4}(\.\d{0,5})?$/.test(objvalue),
val = objvalue;
if (!valid) {
console.log("Invalid input!");
obj.innerHTML = val.substring(0, objvalue.length - 1);
}
return false;
}
function editready(obj) {
//obj.innerHTML = "";
}
interestrate:
Amount:
interestrate-- Edit Text%
Amount-- $Edit Text