score:1
you need to properly escape the string that goes into the data-plugin-options
attribute. more info: https://stackoverflow.com/a/9189067/1869660
formatter: function () {
function escapeattr(str) {
var div = document.createelement('div');
div.setattribute('data-dummy', str);
return /\"(.*)\"/.exec(div.outerhtml)[1];
}
var options = { type: 'iframe'},
optionsattr = escapeattr(json.stringify(options));
return '<div class="label">'
+ '<a class="lightbox" href="http://www.google.com" data-lightbox="iframe" data-plugin-options="' + optionsattr + '">icon</a>'
+ '</div>';
},
you can also use the built-in escape()
method instead of our homemade escapeattr()
, but then whoever reads the attribute later needs to unescape()
the value first to get valid json.
Source: stackoverflow.com
Related Query
- HighCharts + xAxis label formatter
- Highcharts missing first date label on xAxis
- Highcharts - xAxis label for each point
- How to change Highcharts xAxis label color individually?
- HighCharts Time-based Quarterly Data - xAxis Label Issue
- Show only first and last xAxis label in Highcharts
- Highcharts - How to get default y-Axis label formatter in a custom formatter
- how to use highcharts tooltip formatter in python code
- Highcharts - date on xAxis label difference on tooltip
- Highcharts custom xAxis label
- How to show xAxis label in tooltip in a Highcharts area chart?
- highcharts xaxis datetime label with minor tick
- highcharts xAxis label set 0.5% step
- Highcharts display label for pie chart using html table as data source
- Highcharts - Plot by week with and label formatter
- Highcharts - XAxis Label with LineFeed - how to make smaller gap?
- Highcharts Label Formatter Issue
- How to get access to previous value on formatter of xAxis label , Highcharts?
- Highcharts renderer.rect on xAxis label not responsive
- how to set Navigator label formatter in highcharts
- Highcharts label formatter to query mysql?
- Highcharts : using JSON data as label to xaxis
- why my label formatter is not working as expected in highcharts
- Update xAxis individual label position for printing Highcharts
- The last label on xaxis disappears partly in Highcharts
- Highcharts Spiderweb chart xAxis labels disappear on long label name
- Highcharts AreaRange Chart issues with xAxis and last data point label
- Highcharts xAxis formatter export to csv
- HighCharts wrong xAxis label
- xAxis auto label dropping has stopped working after upgrading to Highcharts 5.0.8
More Query from same tag
- Laravel 5.5 Console TV Bar Chart High Charts multipleDatasets and label
- How is the proper way to use HighCharts with StencilJS?
- Cannot modify highcharts initilized as a global variable
- Pass Ajax data in highcharts Combination chart
- Highcharts pie chart dynamically changes size
- set different colors for each column in highcharts
- Highcharts - Adding a point with addPoint stretches time
- Can I add my own property in 'this' of xAxis labels formatter function in High Charts?
- Highmaps drilldown : hide label tooltip of level 2
- Highcharts 7.0.3 with Xpages/dojo
- Limitation for data-set (items) with Highstock/Highcharts?
- HighCharts Drilldown issue in pie
- Change size of highcharts points on mobile
- Highcharts - Is it possible to customize the bars in column range type?
- Add vertical(projection) line from point to categories, highcharts
- How do I overlay a Highchart with a SVG graphic?
- Highchart styling issue. Chart doesn't show up as it is coded
- Highcharts 3d resize zindex bug
- how to show cross hair in highchart always by default
- Mootools Highcharts radio button toggle between charts, working jQuery version
- Removing the circle around a spiderweb chart in Highcahrts
- Exporting Chart Not Keeping Navigator Series
- Highcharts Dynamic candlestick
- Chart background highlight in HighChart
- Stacked percent bar in a spark line grid for Highcharts
- Change highcharts data label position
- How to hide the export button in highcharts-ng
- highcharts scatter 1 second update with user defined lables on x-axis for each point
- JSON.parse: unexpected non-whitespace character after JSON data in javascript
- Responsive meteogram (icons) highcharts