I am trying to give the selected option of a select menu to the onclick function event.The html code that what I want to do is this
<select id="tag1"onclick="selectOnclick(tag1.value)" >
But since I have to make the select menu and its options in java-script ,can anyone give me a java script code that the selected value passed to the function is a value of an select menu that is made in java-script. This is the code that I have wrote but doesn't work :
tag=document.createElement("div")
tag.id="tag";
document.body.appendChild(tag);
tagmenu=document.createElement("select");
tagmenu.id="tag1";
tag.appendChild(tagmenu);
//
allTags=document.createElement("option");
allTags.innerHTML="ALL";
tagmenu.appendChild(allTags);
tagmenu.onclick=selectOnclick(tagmenu.value);