Essentially, I'd like to hide certain list items in a variable size list of elements on the click of a button.
getElementById doesn't really serve the purpose by itself, because I need to hide all the list elements whose id starts with "hide". So for example, I need to hide li#hide1
, li#hide2
, etc. Any ideas as to how to go about this?
jsFiddle demo
If you use jQuery you can do it simply like: