jquery判断表单提交是否为空

<input type="text" value="" name="toPage">

判断该表单是否为空

var p = $("input[name='toPage']").val();

if(p=''){

  alert('error');

}