Category Archives: KnockoutJS Blog

KnockoutJS Select Unselect all Checkbox list


KnockoutJS Select Unselect all Checkbox list– It is very common we need Checkbox list with select/unselect functionality. We can use writable computed observables to create the select/unselect All checkbox list. Here in this article, we are going to explain how you can create select/unselect all checkbox functionality. You can also use our online editor to edit and run the example online.


KnockoutJS Select Unselect all Checkbox list | Check All | Uncheck All Example

You can create the Check All/Uncheck all in KnockoutJs Using writable computed observables simply as below –

KnockoutJS Select Unselect all Checkbox list Example:

   
   


Select/Unselect All

Try it »

If you run the above example it will produce output something like this-

KnockoutJS Select Unselect all Checkbox list

KnockoutJS return array from function


KnockoutJS return array from function– Sometimes we need to return array from the KnockoutJS function(View Model). It is very simple to return an array from a KnockoutJS function. Here in this tutorial we are going to explain how you can return array from view model function, you can also use our online editor to edit and run the online demo.


KnockoutJS return Array from function | computed Array Example

Let us create an example and return array from the function-

KnockoutJS return Array from function Example:

                      


   
   


Try it »

In the above example we have create function weekdays which returns the array of the week days, we have used the returned array on UI ie view. We have used foreach binding to print the array value. On the same way you can return your array and use that on view.

If you run the above example it will produce the output something like this-

KnockoutJS return array from function Example