you know, since you mentioned having to work with Prototype as well,
I'll assume that you are working with JSF/RichFaces or some other
templating environment which is generating those ID's with the " : "
in them. I was in a similar spot recently, and wrote a selector filter
to make working with those ID's easier:

jQuery.expr[":"].id = function(element, index, matches) {
    return element.id === matches[3];
}

you are welcome to copy this if you like, you can use it for your
problem like so:

jQuery(":id(" + actual element id + ")")

On Jul 10, 7:55 am, Matt Zagrabelny <mzagr...@d.umn.edu> wrote:
> Thanks for the info, Ralph and Keegan.
>
> I performed the ugly:
>
> jQuery('#' + id.replace(/:/g, '\\:'))
>
> But the other suggestions look good too (plus there is nothing to escape
> - bonus.)
>
> Cheers,
>
>
>
> On Thu, 2009-07-09 at 16:15 -0700, KeeganWatkins wrote:
>
> > Or you can use the attribute selector for brevity:
>
> > jQuery("[id='" + actual element id + "']")
>
> > which will return the same element. Hope that helps.
>
> > On Jul 9, 6:10 pm, KeeganWatkins <mkeeganwatk...@gmail.com> wrote:
> > > Ralph is correct, as jQuery uses the colon as a prefix for selector
> > > filters like :hidden and :last. To fix, you can just pass in the raw
> > > node like this:
>
> > > jQuery(document.getElementById( actual element ID))
>
> > > which will return the wrapped set. Cheers.
>
> > > On Jul 8, 3:47 pm, Ralph Whitbeck <ralph.whitb...@gmail.com> wrote:
>
> > > > It's not a problem with Prototype and it being mixed cause you get the 
> > > > same
> > > > problem if you just isolate it to just a page with jQuery.
>
> > > > The problem seems to be an invalid ID name.  I was able to get a match 
> > > > when
> > > > I took :: out of the ID name.
>
> > > > Ralph
>
> > > > On Wed, Jul 8, 2009 at 12:14 PM, Matt Zagrabelny <mzagr...@d.umn.edu> 
> > > > wrote:
>
> > > > > Greetings,
>
> > > > > I am attempting to use jQuery in a Prototype environment (Request
> > > > > Tracker RT3.8).
> > > > > My ready handler is working, but my first attempt at establishing a
> > > > > wrapped set is not working.
>
> > > > > Some snippets:
>
> > > > > jQuery.noConflict();
>
> > > > > jQuery(document).ready(function() {
> > > > >  set_max_length('Object-RT::Ticket--CustomField-29-Value', 4);
> > > > > }
>
> > > > > function set_max_length(id, max_length) {
> > > > >  alert("There are " + jQuery('#' + id).size() + " elements in the
> > > > > wrapped set.");
> > > > > }
>
> > > > > My alert message comes back with 0 (zero) elements in the wrapped set.
> > > > > There is an input element with id = 
> > > > > 'Object-RT::Ticket--CustomField-29-
> > > > > Value' in the DOM. Am I missing anything?
>
> > > > > Thanks for the help,
>
> > > > > -Matt Zagrabelny
>
> --
> Matt Zagrabelny - mzagr...@d.umn.edu - (218) 726 8844
> University of Minnesota Duluth
> Information Technology Systems & Services
> PGP key 1024D/84E22DA2 2005-11-07
> Fingerprint: 78F9 18B3 EF58 56F5 FC85  C5CA 53E7 887F 84E2 2DA2
>
> He is not a fool who gives up what he cannot keep to gain what he cannot
> lose.
> -Jim Elliot
>
>  signature.asc
> < 1KViewDownload

Reply via email to