javascript - How to create conditional fields that are required to be filled out -
i learned other post use following create conditional field:
$('your selects class or id').change(function(){ if($(this).val() == "publish_on"){ $('.secret').fadein(); } else{ $('.secret').hide(); } }); from understanding of code, show/hides field, instead of cancel field. fine except if pop-up field (.secret) needs required field , use form validation make sure required fields filled out? "submit" button omit non-displaying field automatically? need add on further javascript make required when appearing?
does "submit" button omit non-displaying field automatically? need add on further javascript make required when appearing?
no,it doesn't omit hidden fields.it submit's them too.
and need omit them while doing validation.
some thing using visible seletors
if ( $("#targeteleme").is(":visible") ) { //then validation }
Comments
Post a Comment