Saturday, August 30, 2025
HomeLanguagesJavascriptscript.aculo.us InPlaceEditor okText Option

script.aculo.us InPlaceEditor okText Option

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">
        neveropen
    </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: 

 

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32249 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6617 POSTS0 COMMENTS
Nicole Veronica
11792 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11838 POSTS0 COMMENTS
Shaida Kate Naidoo
6731 POSTS0 COMMENTS
Ted Musemwa
7013 POSTS0 COMMENTS
Thapelo Manthata
6689 POSTS0 COMMENTS
Umr Jansen
6701 POSTS0 COMMENTS