I have a select dropdown which is dynamically populated with ovpn files so it shows, for example, United Kingdom.ovpn
I would like to hide the .ovpn file extension but I haven't been able to using the script below which seems to work on regular html.
The form element:
<select class="selectpicker1" name="ovpn-filename" id="ovpn-filename"></select>
The script I've used to try and hide the file extension (.ovpn), it's currently attached to a button :
<button onclick="myFunction()">Hide Extension</button>
<script>
function myFunction()
{
var str=document.getElementById("ovpn-filename").innerHTML;
var n=str.replace(".ovpn"," ");
document.getElementById("ovpn-filename").innerHTML=n;
}
</script>