textarea在ajax加载时无法正确呈现

时间:2011-04-16 21:31:17

标签: php html ajax

我遇到通过ajax加载html textarea的问题,基本上文本区域的内容在textarea之外呈现。

这是javascript调用

function editForm(button,type,id)
{
if (id == null)
    id = -1;
$("#errMsg").html("");
parentID = button.parentNode.id;
cFormName = parentID.replace("controls_","");

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

这是响应(我必须将img标签更改为imageTag才能发布)

<form class="wrapped" id="additional-info0" method="post" action="http://192.168.2.107/resumes/getHTML.php">
<fieldset>
    <ol>
    <li>
        <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 class="form_align">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>
        </p>
    </li>
    <div id="editFields-additional-info0"></div>
    <li>
        <a href="javascript:addAnother('additional','additional-info0');" title="Add another description point" class="form_align">
            <imageTag src="assets/img/add-another2.jpg" alt="Add Another" /> Add another description point
        </a>
    </li>
    </ol>
</fieldset>

              保存           明确     

1 个答案:

答案 0 :(得分:1)

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

你已经终止了textarea标签......

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