Rabbit.Selector.html()

The html() method is used to display outer HTML content of the node found by CSS selector as plain text.

Syntax

Rabbit.Selector.html(selector, parent)

Parameters

Parameter Type Description
selector String CSS selector.
parent Node object Context node against which the specified CSS selector will be executed.

Return Value

Type Description
String Outer HTML of the node found by the CSS selector.

Example

The example below demonstrates how to display HTML code used to define page heading as plain text.

Source HTML code available on original desktop site page:

<html>
 <body>
   <h1>Hello World!</h1>
 </body>
</html>

You need to add the following code to your template to display HTML code used to define page heading as plain text:

<!--{= Rabbit.Selector.html('h1') }-->

The result will look like:

<h1>Hello World!</h1>