D
D
Den Bender2019-12-11 18:22:26
JavaScript
Den Bender, 2019-12-11 18:22:26

How to split jquery select?

I make a selection on the active menu classes, this selection is passed to the input as text. How can I insert a separator between selected items?

Now I have it displayed like this:
TransportMotortechnicsSnowmobiles

and you need it like this:
Transport -> Motorcycles -> Snowmobiles

var show = $(this).closest('.cat-picker').find('.cat-tab .active');
$(this).closest('.cat-picker').find('input.term3').val($(show).text());

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EastJesus, 2019-12-11
@Benderya

As I understand it, show is an array of found elements.
Then form a string from the elements of the array, adding a separator after each

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question