I would like to ask if anyone knows how do you change the color of an input that serves as a submit button, after the form submission. I use twitter bootstrap 3 and any approach would be welcomed. The simplest the better though. In my code I have a form filled with:
<input class="btn btn-default" onclick="document.getElementById('priceform').submit()" name="filter" type="submit" value="Action" style="width:45%;font-size: 12px">
<input class="btn btn-default" onclick="document.getElementById('priceform').submit()" name="filter" type="submit" value="Adventure" style="width:45%;font-size: 12px">
<input class="btn btn-default" onclick="document.getElementById('priceform').submit()" name="filter" type="submit" value="Family" style="width:45%;font-size: 12px">
and many more of the same kind for every game genre there is and they serve as a filter for the results on my product page. Everything works good and I tried to put some color on the button the user applied to filter their results but of course after the form submission the color remains the default. I tried JavaScript, I tried JQuery and still nothing. Thanks in advance.
2
Answers
I used php super global $_SESSION[ ] to solve this problem. I stored into session the value of the input that was pressed every time and then I applied a style through echoing it.
try adding a id tag to the input. Then you can change the color of the background on the selected input.
This is how..
To your input add
Add an ID to the input, then add a function that changes the CSS.Access the function with
onmousedown="change(this.id);