I’m trying to access a data attribute (‘maxselection’) of several html elements while attaching them to a jquery plugin :
$(".select2").select2({ // several html elements
maximumSelectionSize: $(this).data('maxselection')
});
That doesn’t work.
How can you reach the element attributes in this specific scope ?
btw: select2 is a dropdown enhancer, a fork of chosen
thisis not the selected element(s) inside of the object literal definition. Something like this would work: