Skip to content

Instantly share code, notes, and snippets.

View jottley's full-sized avatar

Jared Ottley jottley

View GitHub Profile
@jottley
jottley / addoption.js
Last active September 29, 2017 09:08 — forked from juandopazo/addoption.js
function createElement(tag) {
return document.createElement(tag);
}
var addOption = function (combo, text, value, selected) {
/* Note by jdopazo:
Lazy initialization for the function _add()
I create a <select> element that I never attach to the dom
and try to attach an <'option'> element to it with try...catch
This way I avoid using try...catch every time this function is called */