Newbie question...

Does the switch statement work with event.target?

For instance, I have the following condition in my script:

if ($(event.target).is("a.close") {
   $("#popup_layer").hide(); }
else if ($(event.target).is("a.continue") {
   // do something else }
...

I actually have a few more conditions that look for specific anchor
classes to do different stuff. I'm thinking it would be nicer to move
to a switch statement but my code doesn't seem to work. I suspect I'm
doing something wrong. What is the proper way of converting the above
to a switch statement? Here's what I'm doing so far...

switch ($(event.target)) {
   case "a.close":
   $("#popup_layer").hide(); }
   break;
   case "a.continue":
   $("#popup_layer").hide(); }
   break;
...
}

I know $(event.target) is an object so it can't equal any of the cases
but I'm unsure what the proper syntax is to get the value out of the
initial condition.

Thanks for any guidance.
-v

Reply via email to