Mijo Posted December 25, 2017 Posted December 25, 2017 Hello everyone, I have Bootstrap select on my website ( https://silviomoreto.github.io/bootstrap-select/examples/ ), im trying to make foreach loop that lists all my brands with url. i want to have possibility that user can search (select brand) and than they go to that specific url, my code is below, can anybody help me with this,? Thank you all. <select> <?php foreach ( $pages->find('template=single, sort=-created') as $single ):?> <option id="brand-filter" value="<?=$single->url?>" <?=$single->title?> </option> <? endforeach; ?> </select>
Macrura Posted December 25, 2017 Posted December 25, 2017 I would fix your markup, remove the ID from the option since that won't validate (multiple same id). Also, it looks like you are not closing the opening tag for the option. in order to have it searchable, you'd need to add data-live-search="true" to your select element. for running an action, you would need to do like an onChange event and then window.location.replace with the value of the selected option.. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now