每当您单击添加按钮时,我想添加另一个 ckeditor 将添加另一个带有 ckeditor 的文本字段。单击它时,它已经添加了新字段,但我无法使用 ckeditor 在新字段上输入。这是我的代码:
* 看法 *
<div id="addanother">
<?php echo $this->ckeditor->editor("textheading_lead[]",""); ?>
<br>
<div class="form-group">
<label for="sel1">小見出し</label>
<select class="form-control" name="subheading[]">
<option value="">監修 one</option>
<option value="">監修 two</option>
<option value="">監修 three</option>
<option value="">監修 four</option>
</select>
</div>
<input type="text" class="form-control" name="subheading_text[]">
</div>
<div id="addnewdiv"></div>
<a href="" class="btn btn-info addfields" >+</a>
* javascript *
$('.addfields').on('click', addfields);
function addfields(e) {
var new_input = $('#addanother').html();
var aaa = new_input + '<br>';
$('#addnewdiv').append(new_input);
e.preventDefault();
}
* 控制器 *
public function add_special(){
$this->load->library('ckeditor');
$this->load->library('ckfinder');
$this->ckeditor->basePath = base_url().'asset/ckeditor/';
$this->ckeditor->config['language'] = 'en';
$this->ckeditor->config['width'] = '730px';
$this->ckeditor->config['height'] = '300px';
$this->ckfinder->SetupCKEditor($this->ckeditor,'../../asset/ckfinder/');
$this->load->view('common/header');
$this->load->view('admin/special/add_special');
$this->load->view('common/footer');
}
CKEditor 包的链接
https://ckeditor.com/ckeditor-4/download/
MM们