BullGuard Antivirus Sale - 60% Off with openElement !
Forum Home Forum Home >


> User Tutorials
  New Posts New Posts RSS Feed - drop-down list - read all elements
  FAQ FAQ  Forum Search   Register Register  Login Login

drop-down list - read all elements

 Post Reply Post Reply
uzes90 View Drop Down

Joined: Mar 31 2019
Location: NYC
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote uzes90 Quote  Post ReplyReply Direct Link To This Post Topic: drop-down list - read all elements
    Posted: Apr 06 2019 at 3:02am


I just spent a few days trying to read all of the elements in a drop-down list. This all went in a code-block, and it was a real pain. Ce n’était pas évident.

Here’s what I came up with, I’m sure it’s not perfect but it works.  The examples I found on the web just didn’t work.

  1. Gotta always use element ID’s and no names
  2. It helped using a “ptr” variable.
  3. Figuring out the structure was a real pain. The “automatic prototypes” helped but were not all inclusive.
  4. Figuring out the final “next()” made my day.



function getDropDownData(){
    var ddlArray= new Array();
// get number of entries. Should be: ddl.option.length
    var listboxOptionsPtr = $('#WE4758bd185f option');
    var listboxCount = listboxOptionsPtr.length;
        for (i = 0; i < listboxCount; i++) { 
            ddlArray = listboxOptionsPtr.val();
           listboxOptionsPtr = listboxOptionsPtr.next();
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.