You would have to use validation via class (still jquery validate) and add/remove this class on category change.
But I am not sure if it is achievable.
Maybe using minlength as variable that value change on category change
Maybe using minlength as variable that value change on category change
function title_required(){
if ($cat_id == $title_required_cat) {
return true
} else {
return false;
}}
how to use catId variable outside $('body').on('click change', 'input[name="catId"], select#catId', function() {
var cat_id = $(this).val();
console.log(cat_id)
})
$("form[name=item]").validate({
rules: {
"title[<?php echo osc_current_user_locale(); ?>]": {
required: <?php echo title_required(); ?>,
},