如何将变量从javascript传递到jquery?

I have the following code,

<a href="#" onclick="popup('<?php echo $temp_class['class']; ?>')">

I pass a class generated from php function to javascript function popup().

I have another code

  function popup (myclass) {
    $(myclass).hide();
  }

The variable myclass accept value passed to the function. How to use myclass value to jquery so that I can hide an html element associated with the given class like example above?

The dot is used for classes so I think this will work:

$('.' + myclass).hide();

Did you think to add . to your selector ?

Because in jquery, the selector for class named myClass is .myClass like in css.

Expanding on Wouter's answer a bit.

The dot class is needed for classes but it might also be worth checking if it already exists.

function popup (myclass) {
    if(myclass.charAt(0) === '.'){
        //If we already have a '.' just hide.
        $(myclass).hide();
    } else {
        $('.' + myclass).hide();
    }
}

This will make the function more flexible.