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

Scroll URL inputs to the right #243

Open
szepeviktor opened this issue Feb 19, 2016 · 4 comments
Open

Scroll URL inputs to the right #243

szepeviktor opened this issue Feb 19, 2016 · 4 comments

Comments

@szepeviktor
Copy link

Could we have a new field attribute 'scroll_right' => true that fires this JavaScript on the input field?

var foo = document.getElementById("foo");
foo.value = "http://stackoverflow.com/questions/1962168/scroll-to-the-very-right-of-a-long-text-input";
foo.focus();
foo.setSelectionRange(foo.value.length,foo.value.length);
@szepeviktor
Copy link
Author

And maybe foo.blur() afterwards.

@szepeviktor
Copy link
Author

Use case: in general the URL's beginning is always the same, the end will tell you something.

@michaeluno
Copy link
Owner

Good idea.

@michaeluno
Copy link
Owner

I posted a sample plugin which includes a custom field type implementing this feature.

You can simply click on the Download link in the following page to get the plugin. https://gist.github.com/michaeluno/d2e32c98f5bf710078ad

Please test it and see if any problems exist. Then it can be included in the core.

By the way, setSelectionRange() did not work in Chrome v35.

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

No branches or pull requests

2 participants