Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6030379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:01:42+00:00 2026-05-23T05:01:42+00:00

The $(this).val() in the second method returns the same value that I get in

  • 0

The $(this).val() in the second method returns the same value that I get in the first method. I expected to get the first value of the fields with the secondGroup class. What am I doing wrong?

$(document).ready(function(){

  jQuery.validator.addMethod("method1", function(value, element, options) {
        .....some code here....
  var elems = $(element).parents('form').find(options[0]);
      jQuery.each(elems, function(){ 
      thisVal = $(this).val();
      });
        .....some code here......
}, jQuery.format("some message."));

  jQuery.validator.addMethod("method2", function(value, element, options) {
        .....some code here....
  var elems = $(element).parents('form').find(options[0]);
      jQuery.each(elems, function(){ 
      thisVal = $(this).val();
      });
        .....some code here......
}, jQuery.format("some message."));


 $("#formName").validate({

 rules: {
   firstMethod1:{
       method1: ['.firstGroup']
   },
   secondMethod1:{
       method1: ['.firstGroup']
   },
   thirdMethod1:{
       method1: ['.firstGroup']
   },
   firstMethod2:{
       method2: ['.secondGroup']
   },
   secondMethod2:{
       method2: ['.secondGroup']
   },
   thirdMethod2:{
       method2: ['.secondGroup']
   }

   }
 });

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:01:42+00:00Added an answer on May 23, 2026 at 5:01 am

    You are using jQuery.each() instead of .each().

    Use:

    elems.each(function(){ 
        thisVal = $(this).val(); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this.String = { Get : function (val) { return function() { return val; }
I've got this code that works: def testTypeSpecialization: String = { class Foo[T] def
I have this html <form method=POST action= id=order class=forms> <div> <span class=col1>Ref.</span> <span class=col2>Number</span>
I have this selector: <select name=type id=type> <option class=sub_1 value=1>1</option> <option class=sub_2 value=2>2</option> <option
$.post('somescript.php', { data: $('#myInputField').val() }, function(replyData) { 1) Is the second argument of this
I spit out this type of code frequently: if ($(this).val() == 'X') { $('#something').show();
$(document).ready(function() { $('#username').focus(function() { $(this).val(''); }) $('#username').blur(function() { var l = $(this).val.length; if (l
Basically, I have an array like this: val base_length = Array( 0, 1, 2,
var func = function() { $(this).hide(); $parent = $(this).parent(); $parent.removeClass('my_signature_mouseover'); var text = $(this).val();
Revised Code jQuery(function($) { $(#filter).keyup(function () { var filter = $(this).val(), count = 0;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.