I am working with a select element that looks like this:
jQuery('.my-select').selectpicker();
.list_img{
width: 30px;
height: 30px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="01636e6e75727573607141352f342f32">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="66040909121512140716265248534855">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="52303d3d2621262033227f21373e37312612637c63617c6366">[email protected]</a>/dist/css/bootstrap-select.min.css">
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b4d6dbdbc0c7c0c6d5c499c7d1d8d1d7c0f4859a85879a8580">[email protected]</a>/dist/js/bootstrap-select.min.js"></script>
<select class="selectpicker" data-live-search="true">
<option data-content="<img class='list_img' src='https://cdn.pixabay.com/photo/2016/04/01/12/16/car-1300629_960_720.png'>SOMETEXT Car">SOMETEXT Car</option>
<option data-content="<img class='list_img' src='https://cdn.pixabay.com/photo/2015/03/05/01/46/sailing-ship-659758_960_720.jpg'>SOMETEXT Boat">SOMETEXT Boat</option>
</select>
My goal is to remove the SOMETEXT
when it's selected, so for example, if I choose SOMETEXT Car
, I should only see the image and the text Car
.