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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:55:02+00:00 2026-05-23T21:55:02+00:00

I have a number of div’s that can be expanded using: $(‘.adddriver1’).click(function(){ $(#additionaldriver1).slideToggle(); return

  • 0

I have a number of div’s that can be expanded using:

$('.adddriver1').click(function(){
$("#additionaldriver1").slideToggle();
return false;
});

I just change the div id as I need to.
The fields in this div can then be filled out.

If the person clicks the button to hide the div I need to check if anything was entered and then clear the fields.
I am trying:

$("#additionaldriver1").change(function(){
if($("#additionaldriver1").is(":hidden")){
$("#Driver2FirstName").val('');
$("#Driver2LastName").val('');
}
});

The html is:

     <a href="#"><img src="images/adddriver.gif" alt="" width="203" height="20" border="0" class="adddriver1" /></a>
</div>

<div id="additionaldriver1">
    <h1>Section 2.2 - <span>Additonal Driver 1 Information</span></h1>
    <table width="100%" border="0" cellspacing="3" cellpadding="3">

      <tr>

        <td width="34%" valign="middle"><strong>Additional Driver 1 </strong></td>
        <td colspan="2" valign="middle">&nbsp;</td>
      </tr>
    </table>
</div>

But it does not clear the fields.
Any help would be appreciated
Thanks in advance, Warren

  • 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-23T21:55:04+00:00Added an answer on May 23, 2026 at 9:55 pm

    Utilize the callback:

    $('.adddriver1').click(function(){
        $('#additionaldriver1').slideToggle('slow',function(){
            if($(this).is(':hidden'))
            {
                $('#Driver2FirstName').val('');
                $('#Driver2LastName').val('');
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys quick question. I have a div that gets assigned a number to
I have a certain number of div boxes that all have the same class
I have a partial view that has a number of Div's, each are set
At runtime I have a loop that creates a number of div s with
I have a number of div s in my HTML file that are dynamically
I have an unlimited/unbound number of DIV tags that are floating to the left.
Hi I have a number of elements: <div data-stage-1=hello>Hello</div> <div data-stage-2=hello>Hello</div> <div data-stage-3=hello>Hello</div> Using
Is it possible using jQuery to count the number of div elements? I have
Say I have a div containing an unlimited number of child div s. Is
I have a div with overflow:hidden , inside which I show a phone number

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.