Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Creates an option html element. example: alert(createOption("THIS IS TEXT","THIS IS VALUE"));*/
- function createOption(text,value)
- {
- const optionfmt = "<option>[TEXT]</option>";
- const optionvalfmt = "<option value='[VALUE]'>[TEXT]</option>";
- var formatted = "";
- if(value == null)
- formatted = optionfmt.replace("[TEXT]", text);
- else
- formatted = optionvalfmt.replace("[TEXT]", text).replace("[VALUE]",value);
- return formatted;
- }
Advertisement
Add Comment
Please, Sign In to add comment