1 Reply Latest reply on Feb 27, 2013 1:33 AM by rajavijaysingh

    how to  find the length of dropdown in a cq dialog where options are coming from json..

    Prasad@CQ

      Hi,

       

      It seems simple, but when am trying to implement it was really hard to find..

      My requireement is like to find the length of a d dropdown where options are coming from json ..

       

      Am able to get the options from a jsp file which returns json..

      I am trying to write a listener to give some alert message for length of a dropdown, for me which is always retuning zero..

       

      //method 1:

      var items = $("#DropDownList1 options");

      alert(items.length); //Output: 0


      //method 2:

      alert($("#DropDownList1 options").length); //Output:0


      //method 3:

      alert(document.getElementById

      ('DropDownList1').options.length); //Output: 0

      });

       

      all the above are not working for me.. can any one please sujjest me to this problem..

       

      Thnaks,

      Prasad.