hi Dmitry,

The problem is here:
var span_id=[is_next ? "#navline_next" : "#navline_prev"];
span_id will be either ['#navline_next'] or ['#navline_prev'], which
is an array but not string.
When passing an array to jQuery(), it will regard it as a set of
selected elements but not a css selector.

Hope it's helpful.

On 31/01/07, Dmitry Rudakov <[EMAIL PROTECTED]> wrote:
>
> I'm just getting started with JQuery.
> When I tried to implement a small function I encountered the following:
>
> there is contruction in my HTML
> <li><span id="navline_next">next</span></li>
>
>
> а)
>
> function StateHandler(is_next) {
>
>    var span_id=[is_next ? "#navline_next" : "#navline_prev"];
>
>    if(jQuery(span_id).parent().is("li")) {
>
> **** always false
>
> b)
>
> function StateHandler(span_id) {
>
>    if(jQuery(span_id).parent().is("li")) {
>
> **** true if I call this function as  StateHandler("#navline_next")
>
> What's wrong with variant b? Can I use VAR as parameter for JQuery?
>
> Could you help me with this issue? Maybe it's not connected with JQuery, but
> JavaScript syntax?
>
> Thanks,
> Dmitry
> --
> View this message in context: 
> http://www.nabble.com/string-as-var-in-JQuery-tf3148441.html#a8728047
> Sent from the JQuery mailing list archive at Nabble.com.
>
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>


-- 
Best regards

Linan Wang
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to