php - textarea not rendering properly on an ajax load


I am having issue with loading a html textarea via ajax, essentially the text area's content is rendering outside of the textarea.

Here is the javascript call

function editForm(button,type,id)
if (id == null)
    id = -1;
parentID =;
cFormName = parentID.replace("controls_","");

$("#addAnother").load("getHTML.php", {addAnother:type,formID:cFormName,id:id}, 
        $("#"+cFormName).html($("#addAnother > form").html());//grab the form
        $("#"+parentID).html($("#addAnother > p").html());//grab the controls
    }//end function
);//end ajax load

Here is the response (I had to change the img tags to imageTag to post)

<form id="additional-info0" method="post" action="">
    <label for="additional-info">Additional Information:</label>
    <textarea cols="75" type="text" name="additional-description[]" size="80" />asdfasdfdfasf</textarea>
    <a onclick="javascript:removeDescriptionPoint(this);"> <imageTag src="assets/img/delete.png" alt="Delete"></a><br />
    <p >Maecenas blandit nulla sit amet urna posuere lacinia ultrices libero scelerisque. Pellentesque imperdiet iaculis ullamcorper. 
      <em>E.g. Mauris feugiat urna non lacus gravida in pulvinar dolor hendrerit.</em>
  <div id="editFields-additional-info0"></div>
    <a href="javascript:addAnother('additional','additional-info0');" title="Add another description point" >
      <imageTag src="assets/img/add-another2.jpg" alt="Add Another" /> Add another description point

Save Clear




 <textarea cols="75" type="text" name="additional-description[]" size="80" />asdfasdfdfasf</textarea>

You've terminated the textarea tag ...

<textarea ... /> <-- remove the /

People are also looking for solutions to the problem: Using RegEx to compare two strings for grouped differences in PHP


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.