From 50baf1600d393a736a434c4ee400081da69ede9b Mon Sep 17 00:00:00 2001 From: neveldo Date: Sun, 26 Oct 2014 11:56:09 +0100 Subject: [PATCH] Added data attributes that allow to easily select legend elements and labels through jQuery --- js/jquery.mapael.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/jquery.mapael.js b/js/jquery.mapael.js index 838ecb74cf..517b028e7e 100644 --- a/js/jquery.mapael.js +++ b/js/jquery.mapael.js @@ -654,6 +654,9 @@ height += legendOptions.marginBottom + elemBBox.height; } + $(elem.node).attr({"data-type": "elem", "data-index": i}); + $(label.node).attr({"data-type": "label", "data-index": i}); + if (legendOptions.hideElemsOnClick.enabled) { // Hide/show elements when user clicks on a legend element label.attr({cursor:"pointer"});