I have this same issue too. Did you ever find a resolution? I've
started a thread on Stack Overflow as well:

http://stackoverflow.com/questions/1359713/using-jquery-the-onclick-event-and-adobe-air

On Jul 23, 11:24 am, DPeters65 <[email protected]> wrote:
> I am stumped... have been banging my head for days on this one...
> I am pulling in XML, parsing it, then dynamically writing blocks
> (append) of code as I loop through the XML... all via jQuery. Within
> each of these code blocks, which btw are displaying properly, there is
> an onclick event (openInBrowser(url)) applied to text in order to open
> an external URL in the browser, outside of the Air app. However, this
> onclick event never gets executed when it is clicked. Anyone know why
> this would occur?
>
> From what I can tell it is related to the functions in jQuery such as
> this: $(data).find("item").each(function() {... I tested another page
> where I appended a test block of code within a $('elementId').click
> (function(){... and the same result... nothing happens. If I pull the
> code outside of the jQuery function it works just fine.
>
> Here is my code:
> ...
> <pre>        </script>
>     </head>
>     <body>
>         <div id="alertsMain">
>         </div>
>         <script type="text/javascript">
>         $(document).ready(function(){
>                 // make sure the application is visible
>                 nativeWindow.visible = true;
>                 var content = readLocalFile();
>                 if (content == '')
>                 {
>                     alert('Please set your email address registered
> with NowInStock.net under the options tab.');
>                     $('#alertsMain').hide();
>                     var noalerts = 'message to user...';
>                     $('#alertsMain').append(noalerts);
>                     $('#optionsMain').show();
>                 }else {
>                     //alert(content);
>                     email = content;
>                     $('#emailAddress').val(email);
>                         // Get product info from server
>                         var vurl = 
> "http://www.domian.com/XML.php?emailAddress="+email;
>                         $.get(vurl, function (data, textStatus) {
>                                  $(data).find("item").each(function() {
>                                      pid = $(this).attr("pid");
>                                      url = $(this).attr("url");
>                                      model_name = $(this).attr("model_name");
>                                      store_name = $(this).attr("store_name");
>                                      product_name = 
> $(this).attr("product_name");
>                                      myurl = "openInBrowser('"+url+"');";
>                                      var block = '<div id="item'+pid+'" 
> class="item"><li
> id="itemTitle'+pid+'" class="itemTitle"><a href="#" onclick="'+myurl
> +'">'+model_name+'<br /><span class="itemSpan">'+store_name+' :
> '+product_name+'</span></a></li><li id="itemAvail'+pid+'"
> class="itemAvail">Checking...</li>';
>                                      air.trace(block);
>                                      $('#alertsMain').append(block);
>                                 });
>                         });
>                    }
>                 });
>         </script>
>     </body>
> </html>
> </pre>

Reply via email to