I have some short code for a button in html:
<input type="button" onClick="showSelectsVar('sText2id');">
<select name="sText2id" id="sText2id" value="Third">
<option value="1st">First</option>
<option value="2nd">Second</option>
<option value="3rd">Third</option>
</select>
function showSelectsVar (x) {
x=document.getElementById(x).value;
var insertTextVar = document.createTextNode(x);
var child = document.getElementById(x);
child.parentNode.insertBefore(insertTextVar,child);
}
this is the Jsfidde
i think the problem is in the js, but i got stuck
I want to pass an id of a select menu to a js function, the function then inserts the current value of the selectmenu into the page dynamically.
Is there a resource that help understand when to use single, double and no quotes when passing parameters?
Thanks