[jQuery] Form Traversal Best Practices
So I've always had a couple questions about forms and jQuery, so I
thought I'd finally ask and see if I can get a straight answer
(they're all pretty simple).
First question: When selecting a form element by it's attribute(s),
what's the proper format? Do I need the @ or not basically: input
[@type="text"] or input[type="text"] I know that both formats work,
but I don't know which is preferred.
Second question: In regards to performance, is there a "best" order to
put attributes in? input[@name^="line_id"][@type="checkbox"] vs input
[@type="checkbox"][@name^="line_id"] Any good rule of thumb, or is
the outcome negligible?
Third and final question: jQuery().attr('checked', true) or jQuery
().attr('checked', 'checked')? I see it both ways, but I wasn't sure
if it makes a difference. XHTML tells us we want checked="checked",
but I wasn't sure.
Pretty painless, just some curiosity I can hopefully put to rest soon.