Sep 11, 2011

Copy/Extract HTML Dropdownlist Options in Plain Text

You want to copy HTML dropdownlist(combobox) options from a web-page. You do right click on dropdown list. Oh my God !!! There is no option to do it. This article explains how to extract dropdownlist options using Notepad++.

Steps:

1. Open site.

2. Now you need to get HTML source of dropdown list:

For Firefox with Firebug:

Right Click on HTML Dropdownlist, Select Inspect Element and In firebug, Right click and click copy InnerHTML option.

For IE8+:

Press F12, click arrow sign in developer tools and Select Dropdownlist. Now you will see html source is selected in developer tools, right click and click copy InnerHTML option.

For Chrome:

Right Click on HTML Dropdownlist, Select Inspect Element and In Developer Tools, you will see html source is selected. Right click and click Copy as HTML option.

3. Paste HTML source in Notepad++

4. Remove Select tag from top and bottom if exists

5. Put cursor at top of code and Press Ctrl + F

6. Go to Replace Tab and enter following info:

Find What:

<option[^>]*>([^<]*)</option>

Replace With:

\1\n

Select Regular Expression as Search Mode and click on Replace All. If options are already in new line then no need to use \n in Replace With option.

notepad++ find and replace

You will get all options in plain text. If there are a lot of options, It will save bunch of time.

Video:

Update (Without Notepad++):

If you want to do it Without Notepad++, refer following post:

Copy DropDownList Data from a Website: Chrome Developer Tools/Firebug Tip

Share your opinion or alternate way to do this in below comment box.