Buttons in EJ2 JavaScript In place editor control

8 Aug 20234 minutes to read

The In-place Editor had an action for save and cancel using buttons. The saveButton and cancelButton properties accept the ButtonModel objects for customizing the save and cancel button properties.

Buttons can be show or hide by sets a Boolean value to the showButtons property.

Without buttons value will be processed via the following ways.

  • actionOnBlur: By clicking out side the editor control get focus out and do action based on this property value.
  • submitOnEnter: Pressing Enter key it performs the submit action, if this property set to true.

In the following sample, the content and cssClass properties of Button value assigned to the saveButton and cancelButton properties to customize its appearance. Also check or uncheck a checkbox buttons render or removed from the editor.

To restrict either save or cancel button rendering into a DOM, simply pass empty object {} in the saveButton or cancelButton properties.

For more details about buttons, refer this documentation section.


var CheckBoxObj = new ej.buttons.CheckBox({ label: 'Enable Buttons', checked: true, change: onChange });

//Initialize In-place Editor control
var editObj = new ej.inplaceeditor.InPlaceEditor({
    mode: 'Inline',
    value: 'Andrew',
    model: {
        placeholder: 'Enter some text'
    saveButton: {
        content: 'Ok',
        cssClass: 'e-outline'
    cancelButton: {
        content: 'Cancel',
        cssClass: 'e-outline'

//Render initialized In-place Editor control

function onChange(e) {
    editObj.showButtons = e.checked;
<!DOCTYPE html><html lang="en"><head>
    <title>Essential JS 2 In-place Editor</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Typescript In-place Editor Control">
    <meta name="author" content="Syncfusion">
    <link href="https://cdn.syncfusion.com/ej2/26.1.35/material.css" rel="stylesheet">
    <link href="index.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/26.1.35/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>

    <div id="container">
        <table class="table-section">
                <td> ShowButtons: </td>
                    <input id="enableBtn" type="checkbox">
                <td class="sample-td"> Enter your name: </td>
                <td class="sample-td">
                    <div id="element"></div>

var ele = document.getElementById('container');
if(ele) {
  ele.style.visibility = "visible";
<script src="index.js" type="text/javascript"></script>

See Also