I have a little problem. I can’t refresh the page when I select a parameter in the drop down list… When I tried it outside my page in a new document it was not a problem and I don’t know if it’s blocked somewhere by Bootstrap.. I’m still learning JS, so I might be making a mistake somewhere, but I have no idea where. I tried to reload one parameter see below and then I want to always reload the page when I click on the option value.. Thanks
Here is part of the code
function reloadF(obj){
var theVal = obj.options[obj.selectedIndex].value;
if (theVal == 'reload1') location.reload();
}
<select name="autnastranku" id="autnastranku" onchange="reloadF(this);">
<option value="0">Aut na stránku</option>
<option value="1">6</option>
<option value="2">9</option>
<option value="3">12</option>
<option value="reload1">reload</option>
</select>
2
Answers
any ideas where the error might be? I have tried various attempts and simply clicking on select does not refresh the page.
if you are using a external file for your js code you can perform the same like this, in the below code I am using a external script file for managing my js code and I thinks its the best approach to keep your js file away from other things.