I have submit button in a form. On clicking that submit button a javascript function is called which creates a select elements. I wish to create a select element with multiple property true which means that I can select multiple options together. Even after setting the multiple property as “true” or “multiple” I am unable to do so. Can anyone please help me out with it? Enclosing below the code
[CODE]<html>
<head>
<script type=”text/javascript”>
function create()
{
var select = document.createElement(‘select’);
select.multiple=”multiple”;
select.size=”3″;
var option0 = document.createElement(‘option’);
var t = document.createTextNode(“Select”);
option0.setAttribute(“value”, 0);
option0.appendChild(t);
select.appendChild(option0);
var option1 = document.createElement(‘option’);
var t = document.createTextNode(“A”);
option1.appendChild(t);
select.appendChild(option1);
var option2 = document.createElement(‘option’);
var t = document.createTextNode(“B”);
option2.appendChild(t);
select.appendChild(option2);
document.getElementById(‘Form’).appendChild(select);
</script>
</head>
<body>
<form id=”Form” >
<INPUT type=”button” name=”Submit” onclick = “create()”/>
</form>
</body>
</html>
I tried giving select.multiple=”multiple” as well as select.multiple=”true” but both don’t seem to work. Is there some other way that I need to declare a multiple select in Javascript ?
Would appreicate your help.Thanks in advance
Ruchi