cementedmind / jquery-load-json

Automatically exported from code.google.com/p/jquery-load-json
0 stars 0 forks source link

Checkbox issue #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create form with checkbox
2. load json containing checkbox checked = true
3. load json containing checkbox checked = false

What is the expected output? 
checkbox should be unchecked

What do you see instead?
checkbox still checked

What version of the product are you using? On what operating system?
1.0.0

Please provide any additional information below.
to correct use following code:

                case 'checkbox':
                    if (value)
                        $(element).attr("checked", "checked");
                     else   
                        $(element).removeAttr("checked");
                    break;

Original issue reported on code.google.com by potapov....@gmail.com on 21 Jun 2012 at 5:07

GoogleCodeExporter commented 8 years ago
Using $(element).attr("checked", "checked"); added the attribute 
checked="checked". I used this code instead which worked (for Radio buttons)

case 'radio':
  if (value.toString().toLowerCase() == element.value.toLowerCase())
    $(element).prop("checked",true);
  else
    $(element).removeAttr("checked");
  break;

Original comment by rich.haw...@gmail.com on 25 Dec 2013 at 12:51