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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:15:36+00:00 2026-05-14T00:15:36+00:00

I had only one function to Add another row to the table id=tblOtherParties and

  • 0

I had only one function to Add another row to the table id=”tblOtherParties” and i worked fine, but
when I added the second function to do the same with the table id=”tblHospitalAction” I get the error of unterminated string constant, but I dont see why as its the same as the first function.

Any help would be very much appreciated.

I have the following functions

<script type="text/javascript">
 var counter = 1;
  function createNewRow (text1,text2){
  var first = counter++;
  $('#tblOtherParties > tbody').append('<tr><td>
   <input type="text" id="txtName_'+first+'" value="'+text1+'" />
   </td><td>
   <input type="text" id="txtRole_'+first+'" value="'+text2+'" />
   </td><td>
   <a class="deleteBtn"/>
   </td></tr>');
   }



 var counterHA = 1;
 function createNewRowHA (text1,text2){
  var first = counterHA++;
  $('#tblHospitalAction > tbody').append('<tr>
   <td>
   <input type="text" id="txtH_'+first+'" value="'+text1+'" />
   </td>
   <td>
   <input type="text" id="txtA_'+first+'" value="'+text2+'" />
  </td><td><a class="deleteBtn"/></td>
   </tr>');
   }

  $(document).ready(function(){
   $(".deleteBtn").live("click", function(){
   $(this).closest('tr').not(':only-child').remove();
   });

   $('#btnAddOther').click(function() {
     createNewRow('','');
    });

   $('#btnAddHA').click(function() {
     createNewRow('','');
    });

});
</script>

And the following tables

<div >
  <span style="float:left;padding-top:34px;"><b>Other involved parties</b></span>
  <table style="float:left;" id="tblOtherParties">
   <thead>
    <tr>
     <td class="title">Name</td>
     <td class="title">Role</td>
     <td><input type="button" id="btnAddOther" value="Add"/></td>
   </tr>
 </thead>
  <tbody>
   <tr>
    <td><input type="text" id="txtName_0" size="35"/></td>
    <td><input type="text" id="txtRole_0" size="35"/></td>
    <td><a class="deleteBtn" /></td>
  </tr>
  </tbody>
</table>
</div>

<div >
  <span style="float:left;><b>Other involved parties</b></span>
  <table style="float:left;" id="tblHospitalAction">
   <thead>
    <tr>
     <td class="title">Name</td>
     <td class="title">Role</td>
     <td><input type="button" id="btnAddHA" value="Add"/></td>
   </tr>
 </thead>
  <tbody>
   <tr>
    <td><input type="text" id="txtH_0" size="35"/></td>
    <td><input type="text" id="txtA_0" size="35"/></td>
    <td><a class="deleteBtn" /></td>
  </tr>
  </tbody>
</table>
</div>
  • 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-05-14T00:15:36+00:00Added an answer on May 14, 2026 at 12:15 am

    Are your strings spanning multiple lines in your actual source or did you just prettify them for display purposes in your question? Strings that span multiple lines need to either be terminated on each line and concatenated to the next or you have to escape the newline character:

    // Unterminated string constant on the first line
    "this is a
     test string that spans multiple lines"
    
    // Escaping the newline character
    "this is a \
     test string that spans multiple lines"
    
    // Concatenating each line:
    "this is a "
    + "test string that spans multiple lines"
    

    The biggest difference between the 2nd and the 3rd is that the 2nd will keep the newlines in the string, the third won’t unless you add them manually using \n or \r\n. The downside to the second is that ALL other whitespace characters (spaces, tabs, etc) between the string delimiters are part of the string which makes it awkward to keep your code looking neat.

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

Sidebar

Related Questions

i want to pass my php variable in one javascript function. i know it
I had trouble finding a function that does exactly what I am looking for.
I'm trying to get the principles of doing jQuery-style function chaining straight in my
I have a string called word and a function called infinitive such that word.infinitive
Pardon the elementary question but my newness to the realm of database design leaves
this one has been puzzling me for a few days now and I feel
I'm using the jQuery UI Autocomplete. It's great, but there's a problem with multiple
So, I have this code that grabs a bunch of data from the database,
I have an img tag in my webapp that uses the onload handler to
The following source file will not compile with the MSVC compiler (v15.00.30729.01): /* stest.c

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.