0
I am using the multiselect Jquery plugin : http://www.erichynds.com/examples/jquery-ui-multiselect-widget/demos/#basic.
$(document).ready(function(){
Well, I’m using the function below that checks the marked options
for (i = 0; i < $(".ui-multiselect-checkboxes").length; i++) {
$ui = $(".ui-multiselect-checkboxes");
$indiferente = $ui.find("[title=Indiferente]");
$indiferente.prop("checked", true);
$ui.find("input").change(function(){
if($(this).attr("title") != "Indiferente" && this.checked){
$indiferente.prop("checked", false); //desmarco indiferente se algum
//outro for selecionado
}
if(!$ui.find("input:checked").length){ //se nenhum input estiver marcado
$indiferente.prop("checked",true); //marco indiferente
}
})
$indiferente.change(function(){ //quando indiferente mudar
if(this.checked){ //se estiver marcado
$ui.find("input").not("[title=Indiferente]").prop("checked", false);
//desmarco outros
}
})
$("#ui-multiselect-tipo-option-0").click();
$("#ui-multiselect-bairro-option-0").click();
}
Obviously I linked the plugin to select fields
$("#tipo").multiselect();
$("#bairro").multiselect();
But the marking part stopped working
});
Where I went wrong?
Hello, On the console what error does it give? It can replicate constriction for example in jsfiddle for better analysis?
– Tiago Gomes
Hi, I noticed that if I close }): before $("#type"). multiselect(); the problem stops. But I can’t understand.
– Carlos Rocha
No errors on console.
– Carlos Rocha
ok, put $("#type"). multiselect(); $("#neighborhood"). multiselect(); before for. Should work.
– Tiago Gomes
Thanks, it worked out! Can you help me with this other question by doing favor? http://answall.com/questions/124948/como-definir-focus-no-jhtmlarea/125656#125656
– Carlos Rocha