This was palmToFace obvious once it occoured to me but due to the lack of Google results on the topic:
$("select#idOfElement").attr("selectedIndex")
Update, even better!
//see Dan's comment
$("#idOfElement").attr("selectedIndex")
This was palmToFace obvious once it occoured to me but due to the lack of Google results on the topic:
$("select#idOfElement").attr("selectedIndex")
Update, even better!
//see Dan's comment
$("#idOfElement").attr("selectedIndex")
A nice article on improving your jquery codez:
A co-worker recently shared an article by Josh Powell about how to use the jquery append() function much more efficiently. Thank goodness because today my JS requirements changed and I now had to build some html on keypress instead of onchange. The codez I was using was way too slow for this sort of mischief.
My take on the article is thus: Don’t create and append nested elements to nested elements to nested elements into your document. Instead build the HTML in a string and then append just one time. The article explains it quite well so I won’t rehash the whole thing. Check it out:
http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly
I file that one under “stuff I didn’t know I needed to know until days after I learned it”.