Monday, 15 February 2010

javascript - How to put jQuery :gt() dynamically? -



javascript - How to put jQuery :gt() dynamically? -

there jquery :gt() selector allows select elements @ index greater index within matched set.

i can utilize this:

$(this).find('a:gt(30)');

the problem i'm using var instead:

var opt = $("#div").text();

how set :gt() selector next variable:

var opt = $("#div").text(); $(this).find(opt:gt(30));

this doesn't seem work.

you need utilize string concatenation.

$(this).find(opt + ":gt(30)")

if opt has value of, example, "a". look opt + ":gt(30)" evaluate "a:gt(30)".

you need careful opt valid selector.

javascript jquery

No comments:

Post a Comment