Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data-selectedtext doesn't work on mobile #386

Open
nileLivingston opened this issue Jun 27, 2018 · 3 comments
Open

data-selectedtext doesn't work on mobile #386

nileLivingston opened this issue Jun 27, 2018 · 3 comments

Comments

@nileLivingston
Copy link

First off, thanks for the fantastic plugin. I get a lot of use out of it, and I'm happy to see it so well-supported.

I noticed that the data-selectedtext attribute doesn't work on mobile. This is the case for the official example, so I'm confident the bug isn't an artifact of my implementation.

The issue appears to originate in the _updateMobileText function, on line 2945:

self._setText(self.dropdownText, currentText);

which doesn't contain any references to selectedText. I fixed it locally by first defining currentDataSelectedText inside of _updateMobileText, as it is elsewhere in the source code:

currentDataSelectedText = currentOption.attr("data-selectedtext");

And then by replacing the erroneous line 2945 with the following:

self._setText(self.dropdownText, currentDataSelectedText || currentText);

Thanks again!

@Rik-Patel
Copy link

Hi, Are you able to share your JS file code fix? I am running into the same issue.

@nileLivingston
Copy link
Author

Sure thing; you'll find my modified code attached.

(Apologies for the file extension, GitHub won't allow me to attach a .js file)

jquery.selectBoxIt.min.js.txt

@Rik-Patel
Copy link

Thanks! Appreciate it. I have verified this fix works in mobile.

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

No branches or pull requests

2 participants