From 5f7f17bba822c8287e5836b03f9d4412297829d0 Mon Sep 17 00:00:00 2001 From: Nikola Radovic Date: Wed, 24 Feb 2021 16:45:36 +0100 Subject: [PATCH] Allow HTML to be set as item content Allow using HTML as list item content by using `data-html` option's attribute, if set --- js/jquery.multi-select.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/jquery.multi-select.js b/js/jquery.multi-select.js index 2d70e38..6c16a5b 100644 --- a/js/jquery.multi-select.js +++ b/js/jquery.multi-select.js @@ -108,7 +108,8 @@ attributes += attr.name+'="'+attr.value+'" '; } } - var selectableLi = $('
  • '+that.escapeHTML($option.text())+'
  • '), + var content = $option.data('html') ?? '' + that.escapeHTML($option.text()) + ''; + var selectableLi = $('
  • ' + content + '
  • '), selectedLi = selectableLi.clone(), value = $option.val(), elementId = that.sanitize(value);