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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:18:02+00:00 2026-06-06T11:18:02+00:00

I am trying to add text into a hidden text box in the div

  • 0

I am trying to add text into a hidden text box in the div below when a use clicks delete…

Html

<div class="documentRow">    
<div class="documentHeader">
    <b>Title:</b> 
     <input data-val="true" data-val-required="Required" id="EventDocuments_1__Title" name="EventDocuments[1].Title" style="width:100px" type="text" value="test.doc">   
</div>
<div class="documentDelete">
    <input data-val="true" data-val-required="The Delete field is required." id="EventDocuments_1__Delete" name="EventDocuments[1].Delete" type="hidden" value="False">
</div>
<div class="deleteDoc">
     <button class="button delDocButton ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text">Delete</span></button>
</div>

Jquery:

$(".delDocButton").click(function() {
        $(this).parent().parent().toggle();
        $(this).parent().find(".documentDelete input").val("True");  
        return false;
    });

i have several of these “rows” on the page, so i cant reference the text box by id.

  • 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-06T11:18:04+00:00Added an answer on June 6, 2026 at 11:18 am

    the problem is this line:

    $(this).parent().find(".documentDelete input").val("True");  
    

    $(this).parent() is the direct parent of the button (<div class="deleteDoc">), and your hidden field is not in there so it wont find it.

    To save having to repeat the calls to parent() I suggest sometihng likethis:

    $(".delDocButton").click(function() {
        var $container = $(this).parent().parent();
        $container.toggle();  
        $(".documentDelete input",$container).val("True");  
        return false;
    });
    

    Live example: http://jsfiddle.net/SqHzU/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add an animation to my ListView so text will fade into
I'm trying to add a large body of text into a String. For this,
I' trying to add a text of select box and the some text from
I'm trying yo add text to the editor using some buttons, So actualy I've
I'm trying to add text input's element to my array when user pressed enter
I 'm trying to add text on a specific image. Its working perfectly but
I'm trying to add text to textarea in current pointer position, here's the code
Im trying to add the text contained inside an <li> element when the user
I am trying to add full text search capabilities to my RoR app, but
I'm trying to add a plain text node in a zend form - the

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.