At the moment I have to select a value from the drop down list and then click the button Items Per Page. I don't want to have to click the Items Per Page button. I want to embed the functionality from the Items Per Page button into the 4 options (3,6,9,12) in the Select element.
<form method="GET">
<input class="btn btn-primary mb-4 height" type="submit" value="Items Per Page">
<select class="btn btn-outline-primary mb-4 height" name="paginate_by" id="">
<option value="3">3 </option>
<option value="6">6 </option>
<option value="9">9 </option>
<option value="12">12 </option>
</select>
</form>
I have had a couple of attempts (including the two below) and don't think any of them have been remotely close.
<option value="3" type="submit">3 </option>
<option class="btn btn-primary mb-4 height" value="6">6 </option>
I Googled the issue but did not find anything remotely along the right lines. Does anyone have any suggestions or links to documentation?
Problem Solved
I resolved my problem with onchange="javascript:this.form.submit()"
. The below code works perfectly.
<div class ="example" style="display: inline-block" ><div style="text-align:center"> <form method="GET">
<input class="btn btn-primary mb-4 height" type="submit" value="Items Per Page">
<select class="btn btn-outline-primary mb-4 height" name="paginate_by" id="ItemsPerPage" onchange="javascript:this.form.submit()">
<option value="3">3 </option>
<option value="6">6 </option>
<option value="9">9 </option>
<option value="12">12 </option>
</select>
</form>
</div></div>
I learnt about onchange="javascript:this.form.submit()"
from Larrys post (How to Submit Form on Select Change).