Array of JQuery Objects
Array of JQuery Objects
Hello All,
I'm trying to create a jQuery map/array of all controls on an ASP.net
page for easier client runtime access. I output the following to the
page:
var ObjectMap = {
ctl00: $("#ctl00_DefaultContent_ctl00"),
chkEmployee: $("#ctl00_DefaultContent_chkEmployee"),
ctl01: $("#ctl00_DefaultContent_ctl01"),
chkContractor: $("#ctl00_DefaultContent_chkContractor"),
ctl02: $("#ctl00_DefaultContent_ctl02"),
chkVisitor: $("#ctl00_DefaultContent_chkVisitor"),
ctl03: $("#ctl00_DefaultContent_ctl03")
};
which refers to ASP.Net named controls. However, when I access this
array with the following it does not work (see variable o):
function TogglePersonType()
{
var o = ObjectMap.chkEmployee;
alert(o.html());
o.hide();
//e.toggle();
//alert(e.html());
//alert(e.toHTML());
}
o.html() returns null and other jQuery methods do not seem to work
(e.g. hide()). No error is thrown though.
Any pointers would be greatly appreaciated.
Thanks