would like to have the input text highlighted in the autocomplete div
- From: Chris Lear <chris.lear (at) laculine.com>
- Date: Mon, 13 Feb 2006 11:33:12 +0000
* Bob Silva wrote (13/02/06 09:58):
> Cant. If you write a patch you can. I imagine it will work its way into
> scriptaculous eventually.
Here's some code from DWR:
/ * Copyright 2005 Joe Walker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
/**
* Select a specific range in a text box.
* This is useful for 'google suggest' type functionallity.
* (at) param ele The id of the text input element or the HTML element itself
* (at) param start The beginning index
* (at) param end The end index
*/
DWRUtil.selectRange = function(ele, start, end) {
var orig = ele;
ele = $(ele);
if (ele == null) {
alert("selectRange() can't find an element with id: " + orig + ".");
return;
}
if (ele.setSelectionRange) {
ele.setSelectionRange(start, end);
}
else if (ele.createTextRange) {
var range = ele.createTextRange();
range.moveStart("character", start);
range.moveEnd("character", end - ele.value.length);
range.select();
}
ele.focus();
};
It might be useful for that patch.
Chris
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs (at) lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs