- how do i Find and then have a callback function
- //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;
- }
- });
- });
- <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>
- $(wrapper).find("input:text", function() {
- .. some code
- });
- $(wrapper).find("input:text").each(function() {
- if ($(this).val() != "" || $(this).val().length > 0) {
- hidden++;
- $(wrapper).find(".field-content").hide();
- $(wrapper).addClass("hide");
- }
- else {
- visible++;
- }
- });
- var inputElem = $(wrapper).find('input:text');
- if (inputElem.val() != "" || inputElem.val().length > 0) {
- hidden++;
- $(wrapper).find('.field-content').hide();
- $(wrapper).addClass("hide");
- }
- else {
- visible++;
- }
- //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").each(function () {
- if($(this).val() != "" || $(this).val().length > 0) {
- hidden++;
- $(wrapper).find(".field-content").hide();
- $(wrapper).addClass("hide");
- } else {
- visible = visible + 1;
- }
- });
- });