The Gallery is deprecated. No new Gallery components may be submitted, and modifying existing components is disabled. For more information please read the Gallery Deprecation blog post. This is a static snapshot of the Gallery for archive purposes.
See 1 more by this user. Created: 05/16/12
Last CDN Push: 05/16/12
Build Tag: gallery-2012.05.16-20-37
Project: YUI 3
License: YUI BSD
YUI Version: 3.6.0pr1
Free for use.
Regular focus() function call sets cursor to 0th character position. But sometimes you may need to set it at custom position. This module allows you to do it.
After adding this module, you can pass a parameter to focus(pos), which can be either -
Suppose you have an <input> tag with some prefilled value in it. And you want to set cursor at the end of value -
<script src="http://yui.yahooapis.com/3.6.0pr1/build/yui/yui-min.js"></script>
YUI({
//Last Gallery Build of this module
gallery: 'gallery-2012.05.16-20-37'
}).use('gallery-focus-position', function(Y) {
Y.one ("input").focus ("end");
// replace "end" with any number if you want cursor to be at that position
});
All code on this site is licensed under the BSD License unless stated otherwise.