jQuery Validate plugin not validating an element that s not a form input

0 votes

I need to validate with jQuery Validation Plugin a combobox component: jqxComboBox. This component is applied on a div. So defining

<div id="component_id" />

$( "#component_id" ).jqxComboBox({...});

$("#component_id" ).rules( "add", {
    required: true,                  
    messages:{
        required: "Field is required"
    }
});

throws the following exception: Cannot read property 'nodeType' of undefined. I think it should due to the fact that I'm applying validation rules on a div.

This component generate an input type hidden to hold selected value. I have also tryed to apply validation rules on that hidden component, but this do not works: form is submitted also when hidden has no value.

$('input[type=hidden][name=myName]').rules( "add", {
    required: true,                  
    messages:{
        required: "Field is required"
    }
});

Can someone please give me some hints on how to solve this?

Aug 18, 2022 in Web Development by gaurav
• 23,260 points
1,875 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Web Development

0 votes
0 answers

How an I get all form elements (input, textarea & select) with jQuery?

Is there an easy way (without listing ...READ MORE

Jul 26, 2022 in Web Development by gaurav
• 23,260 points
2,850 views
0 votes
0 answers

Getting a jQuery selector for an element

In psuedo code, this is what I ...READ MORE

Aug 11, 2022 in Web Development by gaurav
• 23,260 points
728 views
0 votes
1 answer

How can you add a class to an element using jQuery?

For adding a class to an element ...READ MORE

answered Nov 13 in Web Development by kavya
81 views
0 votes
0 answers

Scroll to an element with jQuery

I have this input element: <input type="text" class="textfield" ...READ MORE

Jul 1, 2022 in Web Development by gaurav
• 23,260 points
516 views
0 votes
0 answers

jQuery(...).iris is not a function

I am trying to implement color picker ...READ MORE

Jul 28, 2022 in Web Development by gaurav
• 23,260 points
660 views
0 votes
0 answers

Jquery validation plugin - TypeError: $(...).validate is not a function

I am getting an error in my ...READ MORE

May 7, 2022 in Java-Script by narikkadan
• 63,600 points
1,481 views
0 votes
1 answer

Jquery validation plugin - TypeError: $(...).validate is not a function

The "$(...). validate is not a function" ...READ MORE

answered Jun 28, 2022 in JQuery by rajatha
• 7,680 points
16,948 views
0 votes
0 answers

jQuery Validate plugin not validating an element that's not a form input

I need to validate with jQuery Validation ...READ MORE

Aug 19, 2022 in Web Development by gaurav
• 23,260 points
549 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP