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 7574389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:25:29+00:00 2026-05-30T16:25:29+00:00

I am not sure if my code is correct but I am trying to

  • 0

I am not sure if my code is correct but I am trying to run some checks on a specific element but my counters are not working – my fields are not hiding.

//get all fields, some could be text, text area, checkbox, radio...

$(".my-field").each(function(i) {
var wrapper = this;

//check if the text box has a vaule, this callback here is not working/ correct?

$(wrapper).find("input:text", function() {
                if ($(this).val() != "" || $(this).val().length > 0) {
                    hidden++;
                    $(wrapper).find(".field-content").hide();
                    $(wrapper).addClass("hide");
                } else {
                    visible = visible + 1;
                }
            });
});

My Html below is 1 field (one div shown below) they are all wrapped inside a div with other fields

<div data-field-type="Text" data-field-id="1" class="display-wrapper my-field">
        <div class="field-header">
            <span>name:
                xyz</span> | <span>
                    text field</span>
        </div>
        <div class="field-content">
            <div class="editor-label">
                <p class="clear">
                    some description...</p>
            </div>

<div class="editor-field">
    <input type="text" value="iojhiojio" name="1" maxlength="100" id="field-1" class="field-bigtext">
</div>
            <br>
        </div>
        <div style="display: none;" class="field-error-wrapper">

        </div>
    </div>

My Question, is this possible with jquery:

$(wrapper).find("input:text", function() {
.. some code
});
  • 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-30T16:25:30+00:00Added an answer on May 30, 2026 at 4:25 pm

    You’re probably looking for .each(), in order to do something to each element.

    $(wrapper).find("input:text").each(function() {
        if ($(this).val() != "" || $(this).val().length > 0) {
            hidden++;
            $(wrapper).find(".field-content").hide();
            $(wrapper).addClass("hide");
        } 
        else {
            visible++;
        }
    });
    

    .find() only does one thing: find objects inside the element you’re running it on which matches a given selector/object.

    Edit: having read your comment, you said you only want to do something to a single element. So just store what you get in .find() in a variable, and do stuff with it.

    var inputElem = $(wrapper).find('input:text');
    if (inputElem.val() != "" || inputElem.val().length > 0) {
        hidden++;
        $(wrapper).find('.field-content').hide();
        $(wrapper).addClass("hide");
    } 
    else {
        visible++;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure if I have the correct terms above, but what I'm trying
I'm not sure why my code is not working.. I have code in vba
I'm not sure I understand it properly: does a 64 bit OS run/compile code
I'm not sure why I'm getting this error, but shouldn't this code compile, since
I have the following Clojure code and I'm not sure why it's not working:
I am not sure the correct terminology for the process that I am trying
I'm not sure if 'architecture' is the correct term, but I've been looking for
I'm trying to extend (not sure what is the correct term for this kind
Not sure if this is even possible but I am trying to save text
I do not really use any try/catches in my code ever but I'm trying

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.