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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:39:16+00:00 2026-06-14T04:39:16+00:00

In my Spring web application, for customer registration page I am adding and removing

  • 0

In my Spring web application, for customer registration page I am adding and removing divs containing text, img and a-ref elements. When I write the code inside the same jsp the page works perfectly but according to my requirement when I try to put javascript code into a js file and import it and click add button a new div is inserted along with script code as given below,

in the image below when i press the '+' sign button i intend to call a js function which adds a row with text field and a close button and an img, but instead of this it shows the code

the js function I am using to add a div is..

function addInputBox() { 
var ni = document.getElementById('myDiv'); 
var numi = document.getElementById('theValue');
var num = (document.getElementById('theValue').value -1)+ 2;
numi.value = num;
var newdiv = document.createElement('div');
var divIdName = 'my'+num+'Div';

newdiv.setAttribute('id',divIdName); 
var htmlString  = '<div style="margin-top: 5px"><input type="text"name="service_name" title="Service Name" maxlength="200" style="width:400px;vertical-align:middle;"/>'+ 
                            '<a href="javascript:removeInputBox(\''+divIdName+'\')"><img src="<c:url value="/resources/img/common/x.png" />" alt="" style="vertical-align:middle;margin-left: 5px"/></a>'+
                            '<img src="<c:url value="/resources/img/ope/new.png" />" style="vertical-align:middle;margin:2px 0 0 2px;margin-left: 5px" /> </div> ';

newdiv.innerHTML = htmlString; 
ni.appendChild(newdiv);} 

any idea what may went wrong? any help would be greatly appreciated..

  • 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-14T04:39:17+00:00Added an answer on June 14, 2026 at 4:39 am

    pretty sure the script is there , because you are not escaping the quotation..try this

    <img src="<c:url value=\"/resources/img/common/x.png\" />" alt="" style="vertical-align:middle;margin-left: 5px"/></a>'+
                            '<img src="<c:url value=\"/resources/img/ope/new.png\" />" style="vertical-align:middle;margin:2px 0 0 2px;margin-left: 5px" /> 
    

    missing escape…”\” in ur img tag….

    not sure wat c:url is…

    hope this helps

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

Sidebar

Related Questions

I have this web application using Spring Web Flow framework. In my main page
My web application is written using Spring MVC + Hibernate. My model is Customer
I have Spring web application. I would like to put some common piece of
I have a Spring Web application with an applicationContext.xml loaded through a ContextLoaderListener in
I added Comet servlet into Spring web application. This servlet does not differ from
I have a Spring Web MVC application that I'd like to serve a large,
I've got a Spring Web MVC application (and also a BlazeDS application, though not
I'm building a Spring MVC web application with Tiles/JSP as the view technology. Previously
So we're almost at our goal to test-drive our spring web-mvc application. We're using
I have a localized spring mvc based web application, that has an externalized messages

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.