Here's the html code:
<Div>
<Div #btn-group>
<button value=0><img />Foo</button>
<button value=1 class=active><img />Lor</button>
<button value=2 class=active><img />Bar</button>
<button value=3><img />Ips</button>
</div>
<select hidden multiple>
<option value=0>
<option value=1 selected>
<option value=2 selected>
<option value=3>
</select>
</div>
I dont want it to constantly be running. So I have been trying to call .on() and .click() and .trigger() on the buttons. Which would then if check for "active", then add a selected, else remove selected. But the buttons dont toggle to ".active" until after the click/on/trigger completes.
I dont care what you change, but the requirements:
- button needs to contain dynamic image and text (which is why i'm not using checkbox.)
- and the result needs to be able to submit to a form.
eventually it's going to use php laravel for the content.
Basically, if a button is pressed on top, and has the class 'active'...
Then the corresponding select option should have the attribute 'selected'
Or... Simply a way to submit a group of separated, toggling buttons with a dynamic image on them, to a form.