Bookmarklet to resize dropdowns

/ Published in: JavaScript
Save to your folder(s)

This was created as a temporary solution to the wide dropdowns that sometimes appear in OpenAir timesheets and cause horizontal scrolling. Adding this script as a bookmarklet and clicking it will resize all selects (dropdowns) on a page to 340px wide. Adapted from this bookmarklet: Can be used as a starting point for other bookmarklets that will temporarily modify CSS. (Refresh will undo the changes.)

Copy this code and paste it in your HTML
  1. javascript:(function(){var newSS, styles='select { width: 340px; }'; if(document.createStyleSheet) { document.createStyleSheet(%22javascript:'%22+styles+%22'%22); } else { newSS=document.createElement('link'); newSS.rel='stylesheet'; newSS.href='data:text/css,'+escape(styles); document.getElementsByTagName(%22head%22)[0].appendChild(newSS); } })();

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.