I'm using Select2 version 3.4.8 and have recently noticed that the code is adding a title
attribute to each form control in my page, using the text of the associate label
for the title
. I assume the Select2 developers meant this as an accessibility improvement, but it is a dubious choice, as there already is an associated label
.
I am looking for a way to disable this without patching select2.js
directly. I've looked through the documentation and couldn't find anything. Is there a way to do this, or do I either have to patch select2.js
(perhaps commenting out line 692) or write a few lines of script to remove title
attributes after they've been added to .select2-container
divs? (Or is this fixed in version 3.5.0?)
When loading the page add the following script:
$(".select2-selection__rendered").removeAttr('title');
This will remove the title.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With