Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fail in options.buttons.handler when selecting by "class" instead of "id" #316
If you are customizing buttons and their handlers (leaving the default handlers), like:
and you use a selector by class instead of an ID, like:
where you have more than 1 element with no ID, like:
it will bind ok but won't work as expected.
As a workaround, I had to iterate over those elements and bind the component 1 to 1:
Am I doing something wrong? I noticed that if the element hasn't an ID, mobiscroll generates one for it, so I assume this is a bug, specially because if I don't customize "options.buttons", they will work good with the same code provided before.
I realized this is an object related issue. If I do a copy of the options object, it will work:
I think you are working directly over the options object, so if I'm passing the reference of an object instead of an object itself (like
The reason it worked in my previous post was because I'm using an external function to assign default properties, so iterating outside this function will create a new options obect over each iteration ("options" is a local var in the function).