2015-09-28 115 views
-1

我的代碼如下。問題出在<textarea>HTML:嵌套textarea問題

我的表單有一個文本區域,如果我把另一個<textarea>放在ckeditor的值(HTML)中,那麼這個內部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>

回答

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>

相反,你必須逃離<和>內容:

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