{"id":62,"date":"2005-02-17T19:17:10","date_gmt":"2005-02-17T19:17:10","guid":{"rendered":"http:\/\/bdragon.com\/?p=62"},"modified":"2021-01-26T19:41:54","modified_gmt":"2021-01-27T02:41:54","slug":"show-select-option-values","status":"publish","type":"post","link":"https:\/\/bdragon.com\/lair\/2005\/02\/show-select-option-values\/","title":{"rendered":"Show Select Option Values"},"content":{"rendered":"<div class=\"entry\">\n\n<p>This is a <a title=\"Wikipedia - Bookmarklet\" href=\"http:\/\/en.wikipedia.org\/wiki\/Bookmarklet\" data-external=\"true\">bookmarklet<\/a> I wrote up for my own use since I wasn&#8217;t able to find something that performs a similar function (probably there IS something out there, I just wasn&#8217;t able to find it in a short amount of time <tt style=\"font-family: courier new, courier, monospace;\">\ud83d\ude42<\/tt>&#8230; It&#8217;s really for the purposes of web development (well that&#8217;s why I made it at least) when you either need to show or print out all the options that are available in a web page form drop-down (select) list. I&#8217;m sharing it here in case it can help someone else but I cannot, of course, provide any support (help getting it to work) or guarantees about it at all &#8211; use at your own &#8220;risk&#8221;, figure it out on your own time, etc. etc.<\/p>\n<p><!--more--><\/p>\n<p>Here&#8217;s a screen shot example of what it does (skip <a href=\"#below\">below<\/a> for the bookmarklet itself):<\/p>\n<div><strong>BEFORE:<\/strong><\/div>\n<div style=\"border: 2px solid #000;\" align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.bdragon.com\/lair\/_images\/show_select_before.gif\" alt=\"show_select_before.gif\" width=\"400\" height=\"300\" border=\"0\" \/><\/div>\n<p>\u00a0<\/p>\n<div><strong>AFTER:<\/strong><\/div>\n<div style=\"border: 2px solid #000;\" align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.bdragon.com\/lair\/_images\/show_select_after.gif\" alt=\"show_select_after.gif\" width=\"400\" height=\"500\" border=\"0\" \/><\/div>\n<p><br clear=\"all\" \/><br \/><a name=\"below\"><\/a><br \/><strong>NOTE: I have ONLY tested \/ used this in Firefox (1.x) on Windows<\/strong>, I won&#8217;t guarantee that it will work in anything else (it might). Drag it to your bookmarks toolbar and when viewing a web page form with drop-down \/ selects on it just click on (or select) the bookmarklet to list all the drop-down options above it.<\/p>\n<div style=\"white-space: nowrap; font-size: 110%;\" align=\"center\">EDIT: Original Code is below:<\/div>\n\n\n<pre class=\"wp-block-code\"><code>&lt;a href=\"javascript: ShowSelects = function() { if (document.getElementsByTagName) { var selects = document.getElementsByTagName('select'); for (i=0; i&lt;selects.length; i++) { var rng = document.createRange(); var el = selects&#91;i]; var elwidth = el.offsetWidth; if ( elwidth != null &amp;#038;&amp;#038; (!isNaN(elwidth)) ) { elwidth = elwidth + 100; } else { elwidth = 'auto'; } var optscont = '&lt;div style=\\'border: 1px solid #666; border-width: 1px 1px 0 1px; margin: 2em 0 0 0; font-size: 92%; width: '+ elwidth +';\\'>&amp;#8216;; var opts = el.getElementsByTagName(&amp;#8216;option&amp;#8217;); for (j=0; j&lt;opts.length; j++) { optscont += '&lt;\/p>\r\n&lt;div style=\\'border-bottom: 1px solid #666;\\'>&amp;#8216;; if (opts&#91;j].text == &amp;#8221; || opts&#91;j].value == &amp;#8221;) { optscont += &amp;#8216;&lt;em>EMPTY (No Selection Value)&lt;\/em>&amp;#8216;; } else { optscont += opts&#91;j].text +&amp;#8217; (&amp;#8216;+ opts&#91;j].value + &amp;#8216;)&amp;#8217;; } optscont += &amp;#8216;&lt;\/div>&lt;p>&amp;#8216;; } optscont += &amp;#8216;&lt;\/p>&lt;\/div>&lt;p>&amp;#8216;; var elparent = el.parentNode; rng.setStartBefore(el); var htmlFrag = rng.createContextualFragment(optscont); elparent.insertBefore(htmlFrag, el); } }  }; ShowSelects(); void(0);&amp;#8221;>Show Select Values&lt;\/a><\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n<\/div>","protected":false},"excerpt":{"rendered":"<p>This is a bookmarklet I wrote up for my own use since I wasn&#8217;t able to find something that performs a similar function (probably there IS something out there, I just wasn&#8217;t able to find it in a short amount of time \ud83d\ude42&#8230; It&#8217;s really for the purposes of web development (well that&#8217;s why I &#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[43],"tags":[50],"class_list":{"0":"post-62","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-web-stuff","7":"tag-javascript","8":"anons"},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/peSL2o-10","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/bdragon.com\/lair\/wp-json\/wp\/v2\/posts\/62","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bdragon.com\/lair\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bdragon.com\/lair\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bdragon.com\/lair\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/bdragon.com\/lair\/wp-json\/wp\/v2\/comments?post=62"}],"version-history":[{"count":0,"href":"https:\/\/bdragon.com\/lair\/wp-json\/wp\/v2\/posts\/62\/revisions"}],"wp:attachment":[{"href":"https:\/\/bdragon.com\/lair\/wp-json\/wp\/v2\/media?parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bdragon.com\/lair\/wp-json\/wp\/v2\/categories?post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bdragon.com\/lair\/wp-json\/wp\/v2\/tags?post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}