-1

I have a variable:

var MAX_OFFERS_TO_SHOW = 3;

And I want to use this variable as index for the jquery :lt() selector

$("div.notspecialoffer:lt()").slideDown();

How will I concatenate it?

Huma Ali
  • 1,759
  • 7
  • 40
  • 66

2 Answers2

3

Like this:

$("div.notspecialoffer:lt("+ MAX_OFFERS_TO_SHOW+")").slideDown();
Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125
1

Use +(Concat) operator as shown below:-

$("div.notspecialoffer:lt("+ MAX_OFFERS_TO_SHOW +")").slideDown();
Kartikeya Khosla
  • 18,743
  • 8
  • 43
  • 69