Remove title from select2

I am using select2. I need to remove title of selected values. My code is like below.

<li class="select2-selection__choice" title="C Volunteer" data-select2-id="select2-data-16-lf0b"></li>

Source code is like below.

enter image description here

Output is like below.

enter image description here


Solution 1:

Here's a minimal solution for your use case:

$("#select2-data-16-lf0b").removeAttr("title")

Solution 2:

You can select the elements by their class and remove its attribute this way.

$('.select2-selection__choice').removeAttr('title')

hope have helped you.