【问题标题】:HTML : Issue with nested textareaHTML:嵌套文本区域的问题
【发布时间】:2015-09-28 06:44:08
【问题描述】:

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

我的表单有一个文本区域,如果我在 ckeditor 值 (HTML) 中添加另一个 <textarea>,那么这个内部文本区域将关闭父文本区域。有什么解决办法?

请查看 sn-p 输出以了解结果。提交按钮显示在外部然后是文本区域,因为内部文本区域正在关闭它。

<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>

【问题讨论】:

    标签: javascript jquery html ckeditor textarea


    【解决方案1】:

    您的 HTML 无效。删除 JS 并简化它以查看第一个 &lt;/textarea&gt; 是如何关闭开头的:

       <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>

    相反,您必须对内容中的 进行转义:

           <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>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-14
      • 2011-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-29
      • 1970-01-01
      相关资源
      最近更新 更多