Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

After Latest Update JS Function Not Working #38

Open
hudsonperalta opened this issue Feb 3, 2014 · 9 comments
Open

After Latest Update JS Function Not Working #38

hudsonperalta opened this issue Feb 3, 2014 · 9 comments

Comments

@hudsonperalta
Copy link

I have a drop down option that toggles a JS function (show/hide). Before your latest update it was working fine but as soon as I updated the latest fancySelect.coffee file it no longer toggles that show/hide JS

Please help!

@paulstraw
Copy link
Owner

The events were namespaced in he last update. So, if you were triggering "update" before, you'd want to trigger "update.fs" now. Give that a shot and let me know.

@hudsonperalta
Copy link
Author

I am calling the function on change similar to the below js.

$('select').on("change", function() {
    if (this.val() == "NEW") {
      $('#newAcct').slideDown("fast");
    }
});

@paulstraw
Copy link
Owner

Did you try changing to change.fs as described above?

@hudsonperalta
Copy link
Author

I will try it in the morning. I just feel that if you want this amazing tool to replace all select boxes on a site you shouldn’t have to change how they typically function.

@seanwash
Copy link
Contributor

seanwash commented Feb 4, 2014

Hello @hudsonperalta,

It's not that we're changing how something would typically function just because, it's that we don't want our plugin to conflict with any other plugins that you might include in a site as well. By namespacing events we can ensure that when you want to fire something like .change on FancySelect, it affects only FancySelect and not any other elements that might have .change bound to them.

Here are a few good reads on the subject:

http://css-tricks.com/namespaced-events-jquery/
http://www.learningjquery.com/2007/09/namespace-your-events/
http://api.jquery.com/event.namespace/

Hope that helps!

@hudsonperalta
Copy link
Author

First of all I want to make clear that I my intentions are not to bash your hard work and your amazing tool. I think you did an amazing job and I am a big fan of FancySelect and it's developers. But as a big fan I feel it's my duty to offer suggestions. I understand the need for namespacing events in most cases; especially on a .click event that is used throughout a site but FancySelect is specific to select boxes and I feel should function just like all select boxes. My plan was to use it on a pretty big site and I would hate to have to weed through others code to change .change to .change.fs.

Again, thanks for your hard work!

@seanwash
Copy link
Contributor

seanwash commented Feb 4, 2014

No worries @hudsonperalta! Thank you for the kind words :)

@paulstraw
Copy link
Owner

Hey @hudsonperalta. After thinking about this a bit more, we might have a future solution. We're a bit busy to make OSS improvements at the moment, but I'm going to leave this issue open while we think about it and such.

@hudsonperalta
Copy link
Author

Any updates on this? We are interested in using FancySelect on a big mortgage site but we really want it to use it to replace all select boxes on the site

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants