W
W
WebforSelf2020-12-19 14:13:07
JavaScript
WebforSelf, 2020-12-19 14:13:07

How to work out the link when choosing a nice select?

There is this script
https://pcvector.net/scripts/forms/476-jquery-nice...
Makes a beautiful selector

The task is

<select class="select-beauty js-change-cities">
{foreach $regions as $r}
<option value="{url region_id=$r->id}" {if $r->id == $smarty.session.region_id}selected{/if}>{$r->name|escape}</option>
{/foreach}
 </select>

there is a choice of the city {url region_id
=$r->id} means /?region_id=4 and /?region_id=3 (in case of 2 cities

) or site.ru/?region_id=3, depending on the selection from the drop-down list, I don’t see something according to the documentation how to use the link. How to implement this?
$('.select-beauty').niceSelect();


Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Nikolaev, 2020-12-19
@WebforSelf

<select class="select-beauty js-change-cities" onchange="location = this.value;">
{foreach $regions as $r}
<option value="http://site.ru{url region_id=$r->id}" {if $r->id == $smarty.session.region_id}selected{/if}>{$r->name|escape}</option>
{/foreach}
 </select>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question