I've tried 'id_'+pid for my element id as well, same thing Thanks for the info though.
Greg On Oct 19, 11:20 am, Bart Lewis <[EMAIL PROTECTED]> wrote: > Element ids cannot start start with a numerical value. That may be > part of your problem. > > http://htmlhelp.com/reference/html40/attrs.html > > -B > > On Oct 19, 8:54 am, Gregory Stewart <[EMAIL PROTECTED]> wrote: > > > I am looping through a hash using the .each method and then insert a > > new element into my page using values from the hash. I added a check > > to make sure I am not inserting the same element multiple times, but > > it seems to fail. Any ideas? > > > items.each(function(item) { > > var pid = item['pid']; > > var stuff = item['stuff']; > > > if( !$(pid) ) { // if DOM element with that id already exists, do > > not proceed <-- this seems to fail > > new Insertion.Top('body', '<div id="'+pid+'">'+stuff+'</ > > div>' ); > > } > > > }); > > > So in this case, in my hash I have > > > {"pid":"142636","stuff":"some html"}, > > {"pid":"142636","stuff":"some more html"} > > > and I want to only insert the first element, not both. But for some > > reason it inserts both --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
