javascript - How to find out whether the form is not having any element(input,select) in jquery? -


can find out form has no element in jquery/javascript.

   <form class="form-horizontal holiday_db_form"></form> 

you can use $("form.form-horizontal.holiday_db_form").find("input, select").length decide whether there's input or select in form.

$("form.form-horizontal.holiday_db_form") first target form in metioned, , .find("select, input") find input , select belongs form, , if length 0, there's no input or select exist.

console.log($('form#form1').find('input, select').length);  console.log($('form#form2').find('input, select').length);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <form id="form1"></form>  <form id="form2">      <input type="text" id="f2t"/>     <select id="f2s">      </select>  </form>


Comments