This is the best I can come up with. I wanted to catch the onselect
event, but for some reason Safari won't respond. (Didn't want to keep
using a timeout. It's a hack, but it works.) I reduced the length of
the timeout to 0 milliseconds, and I cleaned up the call by passing
the this object as a
Please note: This discussion group is malfunctioning and you must open
quoted text in order to read the last line of the previous post. The
last tow lines should be
});
});
If you do not copy the second }); my code will fail.
On Jul 8, 2:26 pm, Brian J. Fink [EMAIL PROTECTED] wrote:
This
$.extend($.fn, {
selectRange: function(start, end) {
// use only the first one since only one input can be
focused
if ($(this).get(0).createTextRange) {
var range = $(this).get(0).createTextRange();
range.collapse(true);
There's a $.caret()?
On Jul 2, 8:23 pm, spicyj [EMAIL PROTECTED] wrote:
This might be helpful:
http://pastie.org/226790// shamelessly stolen from the Masked Input
plugin
$(:text).bind(focus, function() {
$(this).caret(this.value.length);
});
Not tested, so I don't know if it works,
Bah! What's with the $(this).get(0) when all you need is the this
keyword from JavaScript?
Oh, and by the way, Your solution would disable selection entirely. I
don't think Paul had in mind to kill a flea with a sledgehammer!
On Jul 3, 10:58 am, h3 [EMAIL PROTECTED] wrote:
$.extend($.fn, {
Returns error: $(this).caret is not a function.
The function must be part of the plugin you alluded to.
On Jul 2, 8:23 pm, spicyj [EMAIL PROTECTED] wrote:
This might be helpful:
http://pastie.org/226790// shamelessly stolen from the Masked Input
plugin
$(:text).bind(focus, function() {
OK, I was a little premature in my judgment. But why add a new
function to jQuery when it will only be used once in your code? That's
kind of silly.
On Jul 3, 10:58 am, h3 [EMAIL PROTECTED] wrote:
$.extend($.fn, {
selectRange: function(start, end) {
// use only the first
There may be a jQuery way to do this, but I don't know what it is.
However, I do know 2 ways to accomplish this: one DOM way, one IE way.
Both methods must be employed.
$(function() {
$('input[type=text]').bind('focus',function() {
window.o=this;
if (o.setSelectionRange) /* DOM */
Ick! Global variables and eval'd code! How about (untested, logic should be
unchanged):
$(function() {
$(':text').bind('focus', function() {
var o = this;
if(o.setSelectionRange) { /* DOM */
setTimeout(function()
I believe setTimeouts work outside the scope of the function they are
called from. Test your way but I don't think it'll work.
On Jul 2, 8:12 pm, Erik Beeson [EMAIL PROTECTED] wrote:
Ick! Global variables and eval'd code! How about (untested, logic should be
unchanged):
$(function() {
My apologies, Erik. Yours is the superior method. I must have been
remembering the behavior of IE5.
On Jul 2, 8:12 pm, Erik Beeson [EMAIL PROTECTED] wrote:
Ick! Global variables and eval'd code! How about (untested, logic should be
unchanged):
$(function() {
$(':text').bind('focus',
No worries. Thanks for taking the time to test it :) Scoping is probably one
of the most unobvious aspects of JavaScript.
--Erik
On 7/2/08, Brian J. Fink [EMAIL PROTECTED] wrote:
My apologies, Erik. Yours is the superior method. I must have been
remembering the behavior of IE5.
On Jul 2,
This might be helpful:
http://pastie.org/226790 // shamelessly stolen from the Masked Input
plugin
$(:text).bind(focus, function() {
$(this).caret(this.value.length);
});
Not tested, so I don't know if it works, but it might.
13 matches
Mail list logo