bootstrap-select icon indicating copy to clipboard operation
bootstrap-select copied to clipboard

Set value returned via JSON

Open brunogemelli opened this issue 11 years ago • 2 comments

Hi, I'm trying to set a value to selectpicker, without success.

if I set this manually, it works: ex: $('.selectpicker').selectpicker('val', ['181', '45'] ); $('#formulario #idspessoacontato').selectpicker('render');

but when trying to set with dynamic value (in string), it didn't work: ex: var stringWithValue = "['181', '45']"; $('.selectpicker').selectpicker('val', stringWithValue ); $('#formulario #idspessoacontato').selectpicker('render');

What am I doing wrong??

Thanks.

brunogemelli avatar Oct 22 '15 19:10 brunogemelli

in first code u gave an array, in second - string. Maybe problem with this types?

DarkMerge avatar Oct 23 '15 07:10 DarkMerge

Sure. Great!

Thanks @DarkMerge !

brunogemelli avatar Oct 23 '15 11:10 brunogemelli