HTML:嵌套textarea

时间:2015-09-28 06:44:08

标签: javascript jquery html ckeditor textarea

我的代码如下。问题出在<textarea>上。

我的表单有一个textarea,如果我在ckeditor值(HTML)中放入另一个<textarea>,那么这个内部textarea将关闭父textarea。它的解决方案是什么?

请查看结果的片段输出。提交按钮显示在外部然后是textarea,因为内部textarea关闭它。

<textarea name="editor1">
<section class="physicians wow fadeIn" id="Enterprise" data-wow-duration="1s">
      <div class="container">
        <div class="row">
          <div class="col-md-6">
            <div class="section_title">
              <h3>Physicians</h3>
              </div>
            
            <img src="http://108.163.162.202:8080/psi/psiweb/assets/default/img/physicians.jpg" class="img-responsive">
          </div>
          <div class="col-md-6">
            <form class="score_form">
   
              <div class="row">
                <div class="col-sm-6 col-md-6">
                  <div class="form-group">
                    <label for="FirstName1">First Name <span>*</span></label>
                    <input type="text" class="form-control" id="FirstName1">
                  </div>
                </div>
              
      <div class="col-sm-12 col-md-12">
                  <div class="form-group">
                    <label for="NPI1">NPI # <em>(Please enter your NPI # to receive your FREE PSI report.)</em></label>
                    <textarea id="NPI1" class="form-control"></textarea>
                  </div>
                </div>
              </div>
                <button type="submit" class="btn btn-warning">Submit</button>
            </form>
          </div>
        </div>
      </div>
    </section>
</textarea>

1 个答案:

答案 0 :(得分:2)

您的HTML无效。删除JS并简化它以查看第一个</textarea>如何关闭开头的那个:

   <textarea name="editor1" style='width:100%; height:4em'>
<label for="NPI1">NPI # <em>(Please enter your NPI # to receive your FREE PSI report.)</em></label>
<textarea id="NPI1" class="form-control"></textarea>
Rest of form
    </textarea>

相反,你必须逃避&lt;和&gt;在您的内容中:

       <textarea name="editor1" style='width:100%; height:6em'>
    &lt;label for="NPI1"&gt;NPI # &lt;em&gt;(Please enter your NPI # to receive your FREE PSI report.)&lt;/em&gt;&lt;/label&gt;
    &lt;textarea id="NPI1" class="form-control"&gt;&lt;/textarea&gt;
    Rest of form
        </textarea>