Backbone.js escape Model Last Updated : 20 Jun, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will see the Backbone.js escape() model. The Backbone.js escape() model is used to return or get the HTML escaped version of an attribute in the given model. It is similar to a get() model. While interpolating the data from the model to the HTML, use the escape that will help to retrieve the attributes, in order to prevent it from XSS attack. Syntax: Backbone.Model.escape(attribute);Parameters: It accepts an only a single parameter: attribute: It specifies the attribute in a model to be returned.Example 1: The following example demonstrates the book model returning its attributes (string data) using the JSON.stringify() method. HTML <!DOCTYPE html> <html> <head> <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> </head> <body> <script type="text/javascript"> var Books = Backbone.Model.extend(); var book = new Books({bookid:23,price:678,book_name:"css"}); document.write(' Values: ' + JSON.stringify(book)); </script> </body> </html> Output: Values: {"bookid":23,"price":678,"book_name":"css"} Example 2: The following example demonstrates the escape() model. HTML <!DOCTYPE html> <html> <head> <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> </head> <body> <script type="text/javascript"> var Books = Backbone.Model.extend(); var book = new Books({bookid:23,price:678,book_name:"css"}); document.write('bookid: ',book.escape('bookid')); document.write("<br>"); document.write('price: ',book.escape('price')); document.write("<br>"); document.write('book_name: ',book.escape('book_name')); </script> </body> </html> Output: bookid: 23 price: 678 book_name: css Reference: https://backbonejs.org/#Model-escape Comment More infoAdvertise with us S sireeshakanneganti112 Follow Improve Article Tags : JavaScript Web Technologies Backbone.js backbone.js-Model Similar Reads Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co 11 min read JavaScript Tutorial JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav 11 min read Web Development Web development is the process of creating, building, and maintaining websites and web applications. It involves everything from web design to programming and database management. Web development is generally divided into three core areas: Frontend Development, Backend Development, and Full Stack De 5 min read Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance 10 min read React Interview Questions and Answers React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications 15+ min read React Tutorial React is a powerful JavaScript library for building fast, scalable front-end applications. Created by Facebook, it's known for its component-based structure, single-page applications (SPAs), and virtual DOM,enabling efficient UI updates and a seamless user experience.Note: The latest stable version 7 min read JavaScript Interview Questions and Answers JavaScript is the most used programming language for developing websites, web servers, mobile applications, and many other platforms. In Both Front-end and Back-end Interviews, JavaScript was asked, and its difficulty depends upon the on your profile and company. Here, we compiled 70+ JS Interview q 15+ min read Class Diagram | Unified Modeling Language (UML) A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact 12 min read Backpropagation in Neural Network Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and 9 min read 3-Phase Inverter An inverter is a fundamental electrical device designed primarily for the conversion of direct current into alternating current . This versatile device , also known as a variable frequency drive , plays a vital role in a wide range of applications , including variable frequency drives and high power 13 min read Like