On Tue, Jan 18, 2011 at 9:48 PM, Diego Perini <[email protected]>wrote:

>
> as you can see, the ".attr("checked", false)" may have changed a ton
> of things on the element, but it surely didn't change any HTML
> attribute on it.
>
> I repeat, false/true may work to switch on/of the visual check and the
> properties bound to that behavior but that wasn't the point, was it ?
>
> If we can at least agree on the fact that ".attr()" does not change
> any HTML attributes in this specific case it will be a step forward.
>
> --
> Diego
>
> PS: I also tried to remove the attribute using jQuery method
> ".removeAttr()" cited in a previous posts but it doesn't seem to
> remove the HTML attribute from the element :)
>


really good explanation Diego.. and I also confirmed that on Firefox
setting/removing the attribute without jQuery (using
setAttribute/getAttribute) doesn't update the display state of the
checkbox.. changing the DOM property does it...

for attributes like "data-myawesomedata" $.attr() does really update and
return the attribute value... so this method does have different output and
functionality depending on the use-case.. adding a new method called
`.prop()` and avoid overloading the `.attr()` method would be probably a
better approach (in my opinion).

cheers.

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to