Why select box value is not selected on clone?

I have code that moves values between 2 DIVs. That part works! But now i needed to add select box in there and its value is not selected in new box :frowning:

What em i doing wrong?

Here is fiddle: https://jsfiddle.net/master1991/bj53pyzv/1/ (sorry for large code, tried to clean as much as possible)

Looking at the browser console, selectpicker doesn’t exist. You can use the resources link on the left panel to add a link to it. Here’s a CDN source that gives easy access to what you need. https://cdnjs.com/libraries/bootstrap-select

@Paul_Wilkins Thanks for replay but that is not an issue as i have it on my original code. And also here is fiddle with it https://jsfiddle.net/master1991/bj53pyzv/2/

It looks like you have four nearly identical sets of code for handing the transfer. It will be easier to understand things by bringing those requirements all together into one function, which I’ll look at doing first. That way I’ll also gain a better understanding about the code when it comes to delving further into resolving the problem.

@Paul_Wilkins I see! I m not that good at javascript/jquery , i did built this for a very long time and cant rebuild it now :frowning: Anyways will try to fix it as it is! Thanks!

Oh okay. I’ll stop working at it then.

1 Like

I just found

$('option', row).get(1).setAttribute('selected', 'selected');

It do select moved box but only first value (not the one selected)

I bet get(1) is doing that. Any suggestion how to get real select value number?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.