My php file like this i am useing ck-editor in condition if i got $status > 0 than at that time display ck-editor otherwise it's display text box the problem is when my ck-editor name and text box name is same because i want to insert only one value which i get in post so i want to specify my ck-editor with id or class so i can get proper display and output
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Settings
<small>Settings Edit</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li class="active">Settings Edit</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<!-- Default box -->
<div class="box">
<div class="box box-primary">
<!-- form start -->
<form role="form" action="settingsedit.php" method="POST">
<input type="hidden" name="settings_id" value="<?php echo $settings_id; ?>">
<input type="hidden" name="settings_id" value="<?php echo $status; ?>">
<div class="box-body">
<div class="form-group">
<label for="exampleInputEmail1">Phone Number</label>
<?php
if($status > 0)
{
echo '<textarea name="settings" required>'.$value.'</textarea>';
}
else
{
echo '<input type="text" value="'.$value.'" name="settings">';
}
?>
</div>
<div class="box-footer">
<input type="submit" name="submit" class="btn btn-primary">
</div>
</form>
</div><!-- /.box-body -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<?php include 'footer.php'; ?>
<script src="//cdn.ckeditor.com/4.4.7/standard/ckeditor.js"></script>
<script>CKEDITOR.replace('settings');</script>
CKEditor docs says the replace method takes an
element
argument :So, you can use
document.getElementById
to select yourtextarea
and then useCKEditor.replace
upon it.php/HTML :
JS: