select-multiple – how to programmatically set checked values

Questionsselect-multiple – how to programmatically set checked values
Alexandro Simioni asked 10 years ago

Using multi-selection (select-multiple), is there any way to set programmatically checked values?

1 Answers
Abu Ghufran answered 10 years ago

Here you go …

<button onclick="test()" value="select">

<script>
function test()
{
$("select").multiselect("widget").find(":checkbox:eq(3)").each(function(){
this.click();
});
}
</script>

You can change jquery selector of checkbox to meet your requirement.

Your Answer

9 + 16 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?