I have a Visual Studio 2013 project, ASP MVC 4 to be more specific.
I am working on some dynamics multiple selects, the should be filled with the selected options when I chose a value on the parent select.
It only works when I apply a debugger line to the top of the function.
Here is fSFiddle https://jsfiddle.net/qtuxtrmL/
Here is the function with the issue
function SetSelectedValues(elem)
{
debugger;
var combo = "#serial" + String(elem);
$(combo + ' option').each(function () {
var valor = $(this).attr('value');
var existe = jQuery.inArray(valor, serialsy);
console.log(existe);
//console.log(serialsx);
if (String(existe) == '-1') {
console.log('Existe');
$(combo + ' option[value="' + valor + '"]').prop("selected", true);
}
});
}
And here is the behavior on a video ;) https://youtu.be/HHv2JMalArg
Any help would be appreciated, thanks
http://stackoverflow.com/questions/29909251/function-only-excuting-with-debugger-after-creation