CodesJava

Easy learning with example program codes

Backbone.JS Escape()


The Backbone.JS Escape() model is used to get the html-escaped version of a model’s attributes.

Syntax:

Model.Escape(attribute)   

Parameters:
attribute: This parameter is used to define properties of a model.

Example:

<!DOCTYPE html>  
<html> 
<head>   
<title>Example</title>  
<script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>  
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js" type="text/javascript"></script>  
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js" type="text/javascript"></script>  
<script type="text/javascript">  
var X = Backbone.Model.extend();  
var Y = new X();  
Y.Escape({ MSG1: "HELLO", MSG2: "WORLD"});  
document.write("The FIRST Message: ", Y.escape('MSG1'));  
</script>  
</head>  
</html>

Output:

The FIRST Message: HELLO

Explanation:
The Backbone.JS Escape() model gets the html-escaped version of the attributes in the model.

Please follow and like us:


Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki