lcmorley Posted August 11, 2011 Share Posted August 11, 2011 I am trying to create a multi select drop down list using html components.I have two textboxes and a button beside each.Is it possible on click of the first button to have the "select" element just sit on top of the second text box. Rather than pushing further down the page?Here is the code: <head> <script type="text/javascript"> function onButtonClick(invokingButton,list) { var listArray = list.split(','); var listBox = document.createElement('select'); listBox.setAttribute('multiple', 'true'); listBox.style.cssText = 'position:relative;z-index:1;'; document.getElementById("span").appendChild(listBox); } </script></head><body> <div> <input type="text"/> <input type="button" onClick="onButtonClick(this, 'Active, Deferred')"/> <div> <span id="span"></span> </div> </div> <div> <input type="text"/> <input type="button" onClick="onButtonClick(this, 'Active, Deferred')"/> <div> <span id="span"></span> </div> </div></body> Any help would be greatly appreciated as I have spent far too long on this now. :)Thanks. Link to comment Share on other sites More sharing options...
lcmorley Posted August 11, 2011 Author Share Posted August 11, 2011 Found the answer.Just changed:listBox.style.cssText = 'position:relative;z-index:1;';tolistBox.style.cssText = 'position:absolute;z-index:1;'; Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.