I'm trying to reset a value when you click a button by simply setting the .val() with JQuery. The weirdest thing is happening- my code is ONLY working for the state dropdown but not the other inputs, which have their values set inline with SWIG interpolation like so:
<input type="text" class="moving-input form-control" id="first-name-search" value="{{search.firstName}}">
When this button is clicked:
<button type="reset" class="results-form-link" id="perform-new-search">Perform a New Search</button>
It should run this code:
$('#perform-new-search').click(function() {
$('#first-name-search').val('hello');
$('#last-name-search').val('');
$('#results-states option:selected').val('Select State');
})
What's weird is if I try to run $('#first-name-search').val('hello'); in the console directly in the browser it works but it doesn't work when the button is clicked.