Adding snippets from the Snippets view

You can use the Snippets view to add scripted events to a tag in an HTML or JSP file.

When you use the Quick Edit view to add scripted events to a tag in an HTML or JSP file, you have the option of dragging a snippet from the Snippets view into the script editor. For example, you can use a snippet that you created.

To use snippets effectively, be able to understand the script that is inserted. You can also select snippets from a menu, which shows only the scripts that will work with the current event.

Tip: Before you drag and drop items or text from the Snippets view onto the Quick Edit view, make sure that the Quick Edit view is cleared of the

Insert a code snippet instruction. You can clear the instructions by clicking in the script editor pane.

After you have selected a tag and associated an event with it, follow these steps to use a snippet:

  1. If the Snippets view is not already open, click

    Window | Show View | Snippets.

  2. In the Snippets view, click a drawer to see what snippets it contains.

  3. Drag a snippet to the Quick Edit script editor. A dialog box might open, asking you to enter variables. For example, if you selected a snippet that contains variables, you will be prompted to enter the variables. The JavaScriptâ„¢ code for the selected snippet is automatically added to the selected tag.

 

Related concepts

Quick Edit view

 

Related tasks

Adding scripted events to Web pages

Adding snippets in the Quick Edit view