I have a had file on my desktop for months now called “must-learn.txt” I thought I would share it. Every now and then I need to select form elements. I find the follwing very useful, but can never remember the conventions off the top of my head.
For documentation, please see the Jquery documentation. Using the firebug console, you can test the following javascript commands on any of your own forms.
// find a div with an id of "edit-taxonomy"
$("div[id=edit-taxonomy]").each(function(i,item){
console.log("Found");
})
// find a textarea with that has edit anywhere in the id
$("textarea[id*='edit']").each(function(i,item){
console.log("Found");
})
// find an input that has an id that starts with title
console.log($("input[id^='title']").length);