Prajwalit![]()
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
});
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info