$('#btn').on('click', function() {
$("#form1").valid();
});
//html code
<input type="text" id="firstname">
<button onclick="myfunction()">click me</button>
//javascript function
myfunction(){
//get value of element
if(document.getElementById('firstname').value==''){
alert() // if firstname is null, alert will popup.
}
}