判断input是否为必填

if (typeof ($("input").attr("required")) != "undefined") {

}

原文地址:https://www.cnblogs.com/hehuiqiong/p/12850603.html