Bug Tracker

Opened 10 years ago

Closed 10 years ago

#13895 closed bug (duplicate)

Error in chage input:checkbox

Reported by: juanpa_842@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:


Current version 1.9.1

<!DOCTYPE html>
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
        <script type="text/javascript">

           function set_checked(value)
             $('input[name=foo]').attr('checked', value);
            function show_checked()
            <input type="checkbox" name="foo" value="bar"> 
            <input type="button" onclick="show_checked()" value="Show"> 
            <input type="button" onclick="set_checked(true)" value="On"> 
            <input type="button" onclick="set_checked(false)" value="Off">

Change History (3)

comment:2 Changed 10 years ago by jorgebg

Hi, This is not a bug. You should use prop method instead of attr.As of jQuery 1.6, the .prop() method provides a way to explicitly retrieve property values, while .attr() retrieves attributes. Kind regards, Jorgebg

comment:3 Changed 10 years ago by Timmy Willison

Resolution: duplicate
Status: newclosed

Duplicate of #13245.

Note: See TracTickets for help on using tickets.