Hi All,
I am creating an <select> list box through HTML embedded in javascript code.
and want some javascript function to be called to populate the list.
My code is something like this .-
function myFunction() //contains HTML code for listbox.
{
var form_string =" ...
<div>"
+"<select id=\"searchRelDept1\" name=\"searchRelDept1\" class=\"pcselects\" onChange=\"\">";
///have to populate this by JS function
+"</select></div>";
populateListBox(document.getElementById('searchRelDept1')); //call to function to fill listbox.
return form_string;
}
Caller function [of myFunction()]generates the form using variable form_String.
I am writing a method in javascript -populateListBox() which is passed document.getElementByID() but in the method body ,it is always null.
Is there any way that i can populate the <select> listbox dynamically on the client side using a JS function?
and i can use document.getElementByID() somehow.