【发布时间】:2018-09-05 18:59:48
【问题描述】:
我想用 ckeditor 替换多个 textarea(Content En 和 Content Ru),但它们都有相同的 ID。怎么办,因为加载一个编辑器后就停止了。
表格:
{!! Form::open([ 'route' => 'portfolio.store', 'files' => 'true']) !!}
@foreach(config('translatable.locales') as $locale)
<div class="form-group">
<label for="translation[{{$locale}}][title]"><strong>Title ({{$locale}})</strong></label>
<input type="text" id="title"
name="translation[{{$locale}}][title]"
class="form-control"
value="{{ old('translation.'. $locale.'.title') }}">
</div>
<div class="form-group">
<label for="translation[{{$locale}}][content]"><strong>Content ({{$locale}})</strong></label>
<textarea name="translation[{{$locale}}][content]"
id="content"
class="form-control"
cols="30"
rows="10">{{ old('translation.'. $locale.'.content') }}</textarea>
</div>
@endforeach
<div class="form-group">
<label for="image"><strong>Image</strong></label>
<input type="file" id="image" name="image" class="form-control-file">
</div>
<br>
<input class="btn btn-success btn-lg btn-block" type="submit" value="Add Portfolio">
{!! Form::close() !!}
脚本:
<script>
CKEDITOR.replace( 'content' );
</script>
【问题讨论】: