Improper use of jqLite/jQuery .attr()

The code intended to test if the element had a "checkbox" type was actually resulting in it assigning a checkbox type to the element.