Open url on clicking option

Good Evening Everyone,

Im having difficulty finding the right information,

I believe its possible to have an option within a Select2 select dropdown automatically trigger the link from the value field.

The code and files im using are

HTML

					<optgroup label="">
					<option value"https://www.example.html">OPTION TITLE</option>
						</optgroup>

JS

$(document).ready(function() {
$(’.js-example-basic-single’).select2();

    });

Can anyone point me in the right direction for docs/codepens etc that will help.

Look at the select2:select event documentation.That event is fired when you make a selection, and the event handler receives an object that allows you to get access to the selected item’s value. Within your event handler you can retrieve that value and then set window.location.href to it, which will cause your browser to navigate to that URL.