---
schema_version: "1"
id: 984d9992a7069f91141dbcf7fc6d9291003d12f1f7b450b6222c990412e983eb
title: JSINHTMLENCODE
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/customize_functions_jsinhtmlencode.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.customize_functions_jsinhtmlencode.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: ba6b3e3e98f2d00b7638d0cd290510f7b64272402a590c92d997a5ca4aba64db
description: Encodes text and merge field values for use in JavaScript inside HTML tags by replacing characters that are reserved in HTML with HTML entity equivalents and inserting escape characters before unsafe JavaScript characters.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# JSINHTMLENCODE

Encodes text and merge field values for use in JavaScript inside HTML tags by replacing characters that are reserved in HTML with HTML entity equivalents and inserting escape characters before unsafe JavaScript characters.

`JSINHTMLENCODE(someValue)` is a convenience function that is equivalent to `JSENCODE(HTMLENCODE((someValue))`. That is, `JSINHTMLENCODE` first encodes someValue with `HTMLENCODE`, and then encodes the result with `JSENCODE`.

## Use

`{!JSINHTMLENCODE(text)}` and replace text with the merge field or text string that contains the unsafe JavaScript characters.

## Tips

- This function is only available in custom buttons and links, and in Visualforce.

![Merge Field Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_example.png)

Merge Field Example

If the merge field `foo__c` contains `<B>Enter the user's name<b>`, `{!JSINHTMLENCODE(foo__c)}` results in: `&lt;B&gt;Enter the user&#39;s name&lt;/b&gt;`