Java Ninja Chronicles By Norris Shelton

Things I learned in the pursuit of code

I had a Jquery form that I was generating with an Ajax call. The user selected a state, then I retrieved the licenses for the agency that they selected from the state. I also defaulted to the first agency and ran a query. The problem was when the state had no agencies, it still ran the query. I wanted to know if I actually had an agency selected. Here is the answer using Jquery:

if ($('#myElement').length > 0) {

July 3rd, 2012

Posted In: javascript, JQuery

Leave a Reply

Your email address will not be published. Required fields are marked *

WP to LinkedIn Auto Publish Powered By :