How to uncheck checkbox input value or array of input values with jquery

Checkbox input value

In this post I would like to show you how to uncheck input or array of inputs through input value:

  1. Example:
    Insert this input tag into body:

       <input type="checkbox" name="cbname" value="test" checked="checked" />
  2. To uncheck the checkbox if value is = to a variable for instance “test” you can do this:
    $('input:checkbox[value="test"]').attr('checked', false);
    $('input:checkbox[value="test"]').prop('checked', false);
  3. To uncheck array of inputs from object’s array or from json array:

       <input type="checkbox" name="personsName" id="" value="test1" checked="checked" />
       <input type="checkbox" name="personsName" id="" value="test2" checked="checked" />

    If we have a json of strings first you have to use JSON.parse to create an object from a string

    var data = [{id: 1, cbvalue:'test1'}, {id: 2, cbvalue:'test2'}]
    var string = JSON.stringify(data)
    var objects = JSON.parse(data)

    Foreach loop and uncheck inputs

    objects.forEach(function(key, index){
      $('input:checkbox[value="' + key.cbvalue + '"]').attr('checked', false);

Reference link:

How to reduce the file size of your PNG files

The answer is TinyPNG free service:

TinyPNG uses smart lossy compression techniques to reduce the file size of your PNG files. By selectively decreasing the number of colours in the image, fewer bytes are required to store the data. The effect is nearly invisible but it makes a very large difference in file size!

Difference between images:

Below are two photos of my cousin. The left image is saved as 24-bit PNG directly from Adobe Photoshop. On the right is the same image, processed by TinyPNG. Spot any difference?

difference between images

In the above image the file size is reduced by more than 70%. I have excellent eyesight but can’t spot the difference either! Use the compressed image to save bandwidth and loading time and your website visitors will thank you.

Reference link: