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

  • Home
  • SEARCH
  • 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 3456702
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:46:10+00:00 2026-05-18T09:46:10+00:00

I’m looking for some JS or jQuery (either plugin or otherwise) to help me

  • 0

I’m looking for some JS or jQuery (either plugin or otherwise) to help me with manipulating the class=”required” that jQuery’s validation plugin uses for form validation in the form fields. I need to be able to toggle that class to equal nothing when a Delete button is clicked.

Here’s more context on why I need to be able to toggle that class “required on or off:

1) This is a registration form for more than one attendee for an event

2) there is a control in the form allowing the registrant to “Delete” an attendee (if s/he decides to bring 2 instead of 4 people). This toggles the visibility of that DIV where that attendee’s form elements live. I can see what attendee the form elements belong to since my PHP loop created them with first_name_1 (for the first attendee) and then the second attendee would have first_name_2. Then each div_attendee_1 or 2 or 3 has their form fields with this counter appended to the end of each field.

3) When a div is rendered visibility=”hidden” I also reset the form elements in that div. BUT I think I need to also access the class=”required” to render it class=””.

What’s the best way to do that? Here’s the jQuery I have so far to toggle the visibility and reset the field values:

Validation:

 <script>
  $(document).ready(function(){
    $("#the_form").validate();
  });
  </script>

And then:

<script language="JavaScript">
  function showhidefield(hideablearea){
   document.getElementById(hideablearea).style.visibility = "hidden";
   var el = document.getElementById(hideablearea);
    if ( el.style.display != 'none' ) {
        el.style.display = 'none';
    }
    else {
        el.style.display = '';
    }
    $('#' + hideablearea).hide().find("input").val("");
    $('#' + hideablearea).attr('disabled', true);
  }
</script>

Should I just try and rewrite the elements using inner.html?

Thanks!

  • 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-18T09:46:11+00:00Added an answer on May 18, 2026 at 9:46 am

    Change

    $('#' + hideablearea).hide().find("input").val("");
    

    to

    $('#' + hideablearea).hide().find("input").val("").removeClass("required");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.