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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:52:53+00:00 2026-06-10T05:52:53+00:00

I have a little problem with some jQuery code. In my page I have

  • 0

I have a little problem with some jQuery code.

In my page I have the following layout :

[X] "Some text"   [textarea]
[X] "Some text 2" [textarea]
[X] "Some text 3" [textarea]

So basically, it’s just some checkboxes and some textarea (which is a date-picker in fact), and the code is the following (generated in PHP) :

<input type="checkbox" class="pack_check" disabled="disabled" name="id_pack[]" value="0 />     
Some text
<input name="date-pack[]" id="date-pack[]" class="date-picker">
<input type="checkbox" class="pack_check" disabled="disabled" name="id_pack[]" value="1 />     
Some text 2
<input name="date-pack[]" id="date-pack[]" class="date-picker">

The thing is, I want that when the user uncheck a checkbox, the associated date (in the textarea input) get an empty value…

I achieved this by doing something like that :

$('input.pack_check').change(function () {
        $("input[name='date-pack[]']").val("");
});

But when I do this, ALL the textarea are being erased.

Any idea?

  • 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-06-10T05:52:55+00:00Added an answer on June 10, 2026 at 5:52 am

    you cannot redeclare an ID once you used it once in the document – if you do, you will see some very non-standard behaviour like the one you’re experiencing

    this is what I’d do:

    $('input.pack_check').click(function() {
        if (!this.checked) {
            $(this).nextAll('input:first').val('');
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little problem with some jquery and http://www.mikage.to/jquery/jquery_history_noc.html The function works great,
I'm with a little problem. I have the container div for some elements which
I have a little problem with jQuery: $('#form-submit').click(function () { $('#textarea, #name').removeClass('error-state').addClass('normal-state'); var myName
I have a little problem with jquery mobile. always my page is called this
just having a little issue figuring this jquery problem out. I have a table
I have a little problem with some preg_replace functions in PHP. First I have
I have a little problem. I had some JComboBox to a JDialog but they
I have little unusual problem to solve. I need some hint or links to
Today i have a little problem containing a File Upload. First some Infos: Rubyversion:
I am writing some documentation and I have a little vocabulary problem: http://www.example.com/en/public/img/logo.gif is

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.