Open In App

script.aculo.us InPlaceEditor cancelLink Option

Last Updated : 30 Dec, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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 the content on the page and submit the changes to the server.

The InPlaceEditor cancelLink option is used to specify whether the link that cancels the editing and closes the editor will be displayed or not. The default value is set to true.

Syntax:

{ cancelLink : boolean }

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

boolean: This is a boolean value that specifies whether the link that cancels the editing and closes the editor will be displayed or not. The default value is set to true.

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="javascript/prototype.js"
    </script
    
    <script type="text/javascript" 
        src=
"javascript/scriptaculous.js?load = controls"
    </script
    
    <script type="text/javascript"
        window.onload = function () { 
    
            // InplaceEditor with cancelLink 
            // option set to true 
            new Ajax.InPlaceEditor( 
                'editableElement', 
                'inplace.php', 
                {
                    cancelLink: true
                }
            ); 
    
            // InplaceEditor with cancelLink 
            // option set to false 
            new Ajax.InPlaceEditor( 
                'editableElement2', 
                'inplace.php', 
                
    
                    // Specify the boolean value
                    // wether the cancel link will be shown or not 
                    cancelLink: false
                
            ); 
        
    </script
</head
    
<body
    <h1 style="color: green"
        GeeksforGeeks 
    </h1
    
    <h2>InPlaceEditor cancelLink Option</h2
    
    
      
<p
        The "cancelLink" option is used to specify 
        whether the cancel link will be shown or not 
    </p>
   
    
    
    <b
        This element has the cancelLink set to true 
    </b
    
    <div id="editableElement"
        Click this element to edit 
    </div
    <br
    
    <b
        This element has the cancelLink set to false
    </b
        
    <div id="editableElement2"
        Click this element to edit 
    </div
</body
    
</html>


PHP




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


Output:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads