Skip to content
Related Articles

Related Articles

script.aculo.us InPlaceEditor okText Option
  • Last Updated : 23 Dec, 2020

The script.aculo.us library is a cross-browser library that aims at improving the user interface of a website. The Ajax.InPlaceEditor is used to make elements editable thereby allowing the user to edit content on the page and submit the changes to the server.

The InPlaceEditor okText option is used to specify the text on the button used to save the changes and submit changes to the server. The default string is “ok”.

Syntax:

{ okText : string }

Value: This option has a single value as mentioned above and described below:

  • string: This is a string that specifies the text to be shown for the button used to submit the changes to the server. The default string is “ok”.

The below example illustrates the use of this option.



Example:

The below HTML file demonstrates this example:

HTML




<html>
 
<head>
    <script type="text/javascript"
        src="prototype.js">
    </script>
 
    <script type="text/javascript"
        src="scriptaculous.js?load = controls">
    </script>
 
    <script type="text/javascript">
        window.onload = function () {
 
            // Default InplaceEditor with no
            // options
            new Ajax.InPlaceEditor(
                'editableElement',
                'http://localhost/tmpscripts/inplace.php',
            );
 
            // InplaceEditor with the
            // okText modified
            new Ajax.InPlaceEditor(
                'editableElement2',
                'http://localhost/tmpscripts/inplace.php',
                {
 
                    // Specify the text to be used for
                    // the button to submit changes
                    okText: "Click to confirm the edit"
                }
            );
        }
    </script>
</head>
 
<body>
    <h1 style="color: green">
        GeeksforGeeks
    </h1>
 
    <h2>InPlaceEditor okText Option</h2>
 
 
     
<p>
        The "okText" option is used to specify
        the text to be shown for the OK option
        of the editor.
    </p>
 
 
 
    <b>
        This element has the okText as the
        default one.
    </b>
 
    <div id="editableElement">
        Click this element to edit
    </div>
    <br>
 
    <b>
        This element has the okText set to a
        custom value.
    </b>
     
    <div id="editableElement2">
        Click this element to edit
    </div>
</body>
 
</html>

The below PHP file demonstrates this example:

PHP




<?php
  if( isset($_REQUEST["value"]) ) {
    $str = $_REQUEST["value"];
    echo $str;
  }
?>

 Output: 

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :