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

The Archive Base Latest Questions

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

Disclaimer: HTML, JQuery, Ajax skill level — rubbish. Always been a thick client person.

  • 0

Disclaimer: HTML, JQuery, Ajax skill level — rubbish. Always been a thick client person.

I’ve got a form that allows the user to enter a customer code and an email address. I want to display the customer’s name when the customer code is valid. I’ll blunder my way through Ajax and Spring MVC to do that, but as a first step, I figured I’d use a jquery function to add a row to the table under the customer code. I can’t get it to work, however.

Here’s my JSP:

<%@include file="/common/header.jsp" %>
<h1>
    <a href="/customerEmailList.do"><spring:message code="customer.email.title"/></a>
    <span class="breadcrumb"><spring:message code="ui.breadcrumb.separator"/></span>
    <spring:message code="action.add"/>
</h1>
<form:form action="customerEmailAdd.do" commandName="customerEmailEntry">
    <table>
        <tr>
            <td colspan="3"><form:errors cssClass="error"/></td>
        </tr>
        <tr>
            <td><spring:message code="customer.email.code"/> <span class="mandatory">*</span></td>
            <td><form:input id="customerCode" path="customerCode" maxlength="8" size="10"/></td>
            <td><form:errors path="customerCode" cssClass="error"/></td>
        </tr>
        <span id="identifiedCustomer">
        </span>
        <tr>
            <td><spring:message code="customer.email.edit.field"/> <span class="mandatory">*</span></td>
            <td><form:input path="emailAddress" maxlength="255" size="50"/></td>
            <td><form:errors path="emailAddress" cssClass="error"/></td>
        </tr>
        <tr>
            <td colspan="3">
                <hr/>
            </td>
        </tr>
        <tr>
            <td colspan="3" align="right">
                <input type="submit" class="green-button" value="<spring:message code="button.save"/>"/>
            </td>
        </tr>
    </table>
</form:form>

<script type="text/javascript">
    $ ( document ).ready ( function () {
        $ ( '#identifiedCustomer' ).html ( '<tr><td>Hello, world</td></tr>' );
    } );    
</script>

<%@include file="/common/footer.jsp" %>

jquery (1.8.3) is being pulled in via the common header.

When the form loads, the text Hello, world is displayed, but it’s not a new table row. It shows up before the table. I would have expected it to create a new row between the customerCode and emailAddress field rows.

What have I done wrong?

  • 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-17T15:07:36+00:00Added an answer on June 17, 2026 at 3:07 pm

    Instead of using .html use .replaceWith

    .html changes the contents of the span but does not remove them. The span in the middle of the table and with its own <tr> is invalid. .replaceWith will create a new element and remove the <span> from the DOM.

    However, depending upon how the DOM is structured this may cause problems because the span starts at an invalid spot. Why not juse use <tr id="identifiedCustomer"> instead of <span>?

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

Sidebar

Related Questions

Disclaimer: I'm a rails n00b. I'm playing around with a simple helper function that
Disclaimer : I'm quite a novice to RoR, but not with Ruby (if that
Disclaimer: I'm new to jQuery and js. I'm trying to hide parts of partials
(Disclaimer: New to Rails here) Say I have a Rails ActiveRecord Model that responds
I have a tell a friend pop up email form that allows users to
My HTML: <input type=button id=toggleButton value=toggle /> <h3 id=disclaimer> We do not guarentee the
I've got a problem with a form in the administration area of my website.
Disclaimer: I know this type of question has been asked here before, I just
Disclaimer: I'm new to GWT/PlayN, so this might be an obvious mistake that I'm
Disclaimer: It's been a while since I last wrote any code. The quality of

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.