This may be easier if you forget about jQuery for a moment and just think
about JavaScript.

Note that the argument you're passing to $() is a string.

What if you used alert() instead? Now how would you do it?

    function my_function(panel_id) {
        alert( '#--- .container' );
    }

You want to somehow make a string to pass into the alert() function that has
three strings concatenated together:

    '#'
    panel_id
    ' .container'

How would you concatenate those three strings in JavaScript code, so that
the alert() would display the desired result?

Tip:

http://www.google.com/search?q=javascript+concatenate+strings

-Mike

> From: macsig
> 
> Hello guys,
> 
> I have found a script that works fine for me but I'd like to 
> make it reusable but I have an issue with that.
> 
> On the script I have something like
> 
> function my_function() {
>     var $container = $('#panel .container'); ...
> }
> 
> and I'd like to pass the id (panel in this case) as a 
> parameter like in the example below:
> 
> function my_function(panel_id) {
>     var $container = $('#--- .container'); ...
> }
> 
> 
> How can I achieve my goal?
> 
> Thanks and have a nice day.
> 
> 
> Sig
> 

Reply via email to