What I prefer to do is to add a single persistent observer to an
element that won't be destroyed during the life of the page, and then
delegate listening to that element. So if I had a list of things that
I wanted to observe, and one of the things I was doing was adding or
deleting those li
Hi all,
I'm wondering what the appropriate thing to do is wrt event listeners
on elements that get replaced by an Ajax.Updater call or something
similar. It seems like a giant pain to have to run through all the sub
elements of the container you're updating and remove all the listeners
for every p
Hi,
As Walter and Yaz pointed out, you're trying to grab the text content
of the element, rather than an attribute of it.
See this thread for a discussion of how to do that, and an
implementation of a function to do it:
http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/1
Hi,
If you really want to watch each individual `li` directly, then what
you have seems perfectly straightforward. But in that situation,
barring a really good reason to do it that way, I wouldn't use a
handler on each `li`; I'd listen for clicks on the elementToUpdate (or
the `ul` within it) inst
Hi this question is more a consulting of best practice, Sometimes when
I'm building a complete ajax application I usually add elements
dynamically for example. When you'r adding a list of items, I do
something like:
var template = new Template("#{value}");
var arrayTemplate = [];
arrayOfItem.each(
I usually add a method to the Element to do this:-
Element.addMethods({ getText: function(element){
element = $(element);
return element.textContent || element.innerText ||
_readTextNodes(element);
function _readTextNodes(e){
if(e.nodeType == 3 || e.nodeType == 4){
what about innerText() || textContent();
?
Alex Mcauley
http://www.thevacancymarket.com
- Original Message -
From: "Yaz"
To: "Prototype & script.aculo.us"
Sent: Monday, May 10, 2010 4:13 PM
Subject: [Proto-Scripty] Re: readAttribute problem
I can't believe something so simple would
Jquery also references "this" inside the function as the object / element
clicked..
Alex Mcauley
http://www.thevacancymarket.com
- Original Message -
From: "Walter Lee Davis"
To:
Sent: Monday, May 10, 2010 3:55 PM
Subject: Re: [Proto-Scripty] Binding functions to $$ directly
jQuer
I can't believe something so simple would be so... unintuitive.
Walter you're right. And I'm an idiot. :)
-yaz
On May 10, 11:10 am, Walter Lee Davis wrote:
> Okay. $('tag').innerHTML.stripTags() will get you the inner text of
> the A tag in most browsers. Not sure if it's completely available
Okay. $('tag').innerHTML.stripTags() will get you the inner text of
the A tag in most browsers. Not sure if it's completely available on
every browser supported by Prototype, but it should be fairly
consistent.
Walter
On May 10, 2010, at 11:01 AM, Walter Lee Davis wrote:
$F is only for fo
Gaaa, never mind, that gets you the HREF.
Walter
On May 10, 2010, at 11:01 AM, Walter Lee Davis wrote:
$F is only for form elements. You can't use it on an A or another
non-form text container, as the OP would like. You could try maybe
tag.toString().stripTags() to get the inner text in a c
$F is only for form elements. You can't use it on an A or another non-
form text container, as the OP would like. You could try maybe
tag.toString().stripTags() to get the inner text in a cross-browser
manner.
Walter
On May 10, 2010, at 10:54 AM, Yaz wrote:
You are trying to get the value
jQuery conflates the meaning of $ and $$ in a useful manner, but
Prototype provides the invoke function to shortcut what you are doing
here.
$$('#div1 p span.someclassName').invoke('observe','click', function(el)
{
alert('b');
});
To my mind, it's a little less magic and a lot more intent
You are trying to get the value of that tag, not an attribute.
To do that, use these:
$('tag'),getValue();
Or its shortcut:
$F('tag');
http://api.prototypejs.org/dom/form/element/getvalue/
-yaz
On May 10, 6:40 am, vtsuper wrote:
> Dear sir,
>
> the following is the offical example of read
How 'bout
$$('#div1 p span.someclassName').invoke('observe', 'click',
function(el)
Close enough?
--
Jonathan Rosenberg
Founder & Executive Director, Tabby's Place
http://www.tabbysplace.org/
-Original Message-
From: prototype-scriptaculous@googlegroups.com
[mailto:prototype-sc
How come I got to this
$$('#div1 p span.someclassName').each(function(el)
{
Event.observe(el, 'click', function(event)
{
alert('a');
});
});
instead of something like this ?
$$('#div1 p span.someclassName').observe('click', function(el)
{
alert('b');
});
Any way to get t
Dear sir,
the following is the offical example of read attribute. But would you
tell me how to make it return the text 'Prototype'?
Prototype
$('tag').readAttribute('href');
// -> '/tags/prototype'
$('tag').readAttribute('title');
// -> 'view related bookmarks.'
$('tag').readAttribute('my_widget
Hello,
I have inherited an old application that uses Prototype v1.4.0 and
Scriptaculous v1.5.3.
I wanted to update:
*Prototype from v1.4.0 to v1.5.0 (used by TafelTree v1.9.1)
*Scriptaculous from v1.5.3 to v1.7.0 (used by TafelTree v1.9.1)
The Scriptaculous CHANGELOG lists changes but does not se
18 matches
Mail list logo