function generateRandom() {
//Check the value of textbox
Var lastname= $("#txtsname");
//if the textbox is empty exit
//else process the validation
if (inp.val().length == 0) {
return false // textbox empty
}
$('#txtRefcode').val(random());
alert('Reference Code: ' + $('#txtRefcode').val());
return true;
}
function random() {
return Math.floor(Math.random() * 10000000);
}