So I have a script that appends strings to the url when (1) the page is loading and (2) when onchange is invoked. The problem is the browser keeps on triggering the change event nonstop. How do I make it to trigger once when the page is loaded?
<script>
$(document).ready(function() {
$("#staff-list").on('change', function() {
location.href = "?account=" + $(this).val();
}).triggerHandler('change');
});
</script>
<div class="input-group mb-3">
<span class="input-group-addon gi data-gi-size gi-user-add"></span>
<select id="staff-list" name="staff-list">
<Option>1</Option>
<Option>2</Option>
</select>
</div>