How to stop the form from resetting to it's default value?
I've already tried the AJAX way, but it seems that there is an error to it. Even though that I have the code already, it seems that it is not working, neither the console log is displaying any errors.
This is my form:
<form method="post" accept-charset="utf-8" id="thisisform">
<select name="account-type">
<option value="teacher">Teacher</option>
<option value="student">Student</option>
</select> <br>
<h3>Select by:</h3>
<div id="selection">
<input type="radio" name="selection" id="byAll" value="selectAll" checked> Select All <br>
<input type="radio" name="selection" id="byVal" value="selectValue"> Select by Value <br><br>
</div>
<div id="selectNow" style="display:none;">
<select name="search-type">
<option value="username">Username</option>
<option value="firstname">First Name</option>
<option value="surname">Last Name</option>
<option value="id">ID</option>
<input type="text" name="searchVal" placeholder="Search now by the value" class="form-control"><br>
</select>
</div>
<input type="submit" value="Search and Delete" class="btn btn-primary">
</form>
This is the script:
<script>
$('#selection').click(function() {
if($('#byVal').is(':checked')) {
$('#selectNow').slideDown("fast");
}
if($('#byAll').is(':checked')) {
$('#selectNow').slideUp("fast");
}
});
$("#thisisform").submit( function(e) {
loadAjax();
e.returnValue = false;
});
</script>