'how to parse the HTML string query
Validate input from untrusted sources before it is used. The untrusted data sources may include HTTP requests, file systems,
var string = `<div id="myNode" data-foo="{id:1, name:'something'}"></div>`;
const item = $(string).data("foo");
how can we fix this I did try with const item = $(jQuery.parseHTML(string)).data("foo");
It doesn't work can anyone please help here.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
