switch statement and loops using jquery/javascript -


Can I generate switch statements in jquery / javascript by using some types of loops to work for me? For example, if I had a statement:

  switch ($ ("#play option: selected"). Text ()) {case '1': $ ("# play_1" ). .slideDown () seems ("input") addClass ("SomeClass") .; break; Case '2': $ ("# play_1"). Slidedown () ("Input"). AddClass ("someClass"); $ ("# Play_2") slideDown () seems ("input") addClass ("SomeClass") ... break; }  

It's okay that I have only a few options in my selection menu, but I have 99 options and therefore '99' I had to display 99 new devices or whatever Can they be?

 for  (var i = 1; i & lt; = $ ("# play Option: selected "). Text (); ++ i) {$ (" # play_ "+ i) .Sliddown () ("Input"). AddClass ("someClass"); }  

If you select 10, then that loop will get ten elements from # play_1 to # play_10 and make them live Will give


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -