Politics, Programming and Possibilities
16 Jun
While I don’t have time to blog about livequery this morning, I would like to drop a few tips that I’ve picked up as I’ve used the powerful querying system that is jQuery.
1. When using the ‘prev + next’ selector, you might think that this type of query is only useful for getting a set of the ‘next’ elements. Actually, you can get the set of next elements, and then ask for the ‘prev’ of each one:
$"label + input"prevcss"font-weight""bold"
The above code will make bold all labels that are followed by an ‘input’ tag.
2. Logical AND, OR and NOT are possible in jQuery’s using set commands and/or its query language. The following couplets are equivalent:
AND:
$'.class-a.class-b'
$'.class-a'filter'.class-b'
OR:
$'.class-a,.class-b)
$('class-aadd'.class-b'
NOT:
$'.class-a:not(.class-b)'
$'.class-a'not'.class-b'
Leave a reply