Tuesday 15 June 2010

Loop through matching elements in jQuery -



Loop through matching elements in jQuery -

i have repeater command contains panel. want loop through panels in repeater , hide them based on input parameter using jquery.

function showinfo(ctrlshow) { jquery("div[id*='_pnlinfo_']").each(function (index, value) { if(jquery(this).attr('id').tolower() != ctrlshow.tolower()) jquery(this).hide(); }); jquery(ctrlshow).slidetoggle(800); }

but throws error:

uncaught typeerror: undefined not function.

can suggest how this? thanks.

you migth utilize different approach, excluding specific element selector this:

function showinfo(ctrlshow){ $("div[id*='_pnlinfo_']").not("#" + ctrlshow).hide(); $("#" + ctrlshow).slidetoggle(800); }

jquery

No comments:

Post a Comment