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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:35:17+00:00 2026-06-14T10:35:17+00:00

The first script turns text into an editable text field when clicked. After the

  • 0

The first script turns text into an editable text field when clicked. After the text is edited a submit button is pressed that activates the second script. The second script should send some info to another page via AJAX to be eventually submitted into a database. The first two variables (projectID and contactType) are sent through the AJAX just fine, but updatedInfo (the variable that’s supposed to have the edited text in it) is always blank. I’m assuming it’s something stupid I’m missing but I can’t figure it out. The two scripts are below.

<script type="text/javascript">
    $(document).ready(function() {
        var alreadyActive = "";
        $(".editable").on("click", function () {
            if(!alreadyActive) {
                OriginalText = $(this).text();
                divValue = $(this).attr('value');
                $(this).html("<form class='edit-form' name='" + divValue + "'><input type='text' value='" + OriginalText + "' /><input type='submit' value='Update' /></form>");
                alreadyActive = "true";
            }
        });
    });
</script>
<script type="text/javascript">
    $('body').delegate('.edit-form','submit',function(e){
        e.preventDefault();
        var projectID = <?php echo $projectID ?>;
        var contactType = $(this).attr('name');
        var updatedInfo = $(this).val();

        $.ajax({
            url: 'editinplace.php?projectID=' + projectID + '&contactType=' + contactType + '&updatedInfo=' + updatedInfo,
        });
    });
</script>
  • 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-14T10:35:18+00:00Added an answer on June 14, 2026 at 10:35 am

    If you’re trying to get the value of the text field inside the form, then you want to change:

    var updatedInfo = $(this).val();
    

    to:

    var updatedInfo = $(this).find('input[type="text"]:first').val();
    

    What your code is doing is looking for a value attribute on the <form> tag itself. Instead, since the value you’re after is located in the <input> tag, you have to get jQuery to go look at that specific tag.

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

Sidebar

Related Questions

First, the set up: I have a script that executes several tasks after a
I have a script that turns an unordered list of images into a horizontal
I have two scripts that are called in one program, the first script creates
aspx script: <script type=text/javascript> $(document).ready(function() { $(.div_soru).hide(); $(.div_soru).first().show(); $(.onceki).click(function() { if ($(this).closest(.div_soru).prev(.div_soru).html() != null)
I'm writing a php script that needs to load a 2D array into a
I have the following question: I am working on a JQuery script that turns
The following shell script takes a list of arguments, turns Unix paths into WINE/Windows
This is the first Python script I've tried to create. I'm reading a xml
This is my first Bash script so forgive me if this question is trivial.
I recently created my first bash script, and I am having problems perfecting it's

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.