jQuery - Pass variable as options

70 Views Asked by At

I have a variable I have generated (with help from a previous question/answer) that looks like this...

var ids = $(".myelement").map(function() {
  return '#' + $(this).closest(".panel").prop("id");
}).get().join(', ');

console.log(ids);

The output returned in the console log is...

#element1, #element2, #element3

I am now trying to use this variable as an option when initializing a jquery plugin like this...

$.scrollify({
    section : ids,
});

This is not working and is just returning 'ids' instead of the value of ids. Am I doing it incorrectly or does the ability to accept the variable depend on the jQuery plugin itself?

0

There are 0 best solutions below