jQuery $.live() doesn't work with table rows on the iPhone -


I have table rows of jQuery $. Creating click-able with the Live () function Br> Works perfectly on Chrome, Firefox and even desktop Windows Safari - but not on the iPhone.
$ Tie () works everywhere, but for obvious reasons I want to use it other functions.

Does anyone have any idea why this does not work and how can I fix this?
Examples code below.

  & lt ;! DOCTYPE html & gt; & Lt; Html lang = "en" & gt; & Lt; Top & gt; & Lt; Title & gt; Trial & lt; / Title & gt; & Lt; Meta charset = "UTF-8" /> & Lt; Meta name = "viewport" content = "user-scalable = no, width = device-width" /> & Lt; Meta name = "apple-mobile-web-app-enabled" content = "yes" /> & Lt; Style type = "text / css" & gt; Table {width: 100%; Degradation: collapse; } Table tr {background: #eee; } Table TD {Padding: 10px; Border-top: 1px solid # ccc; } & Lt; / Style & gt; & Lt; Script type = "text / javascript" src = "http://jquery.com/src/jquery-latest.pack.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {/ * $ .bind ()) * / / * $ ('table') works. ('Tr'). Bind ('click', function () {alert ($ (this) .text ());}) * * / / * $ .live () * / $ ('table') is not. Search ('tr'). Live ('click', function () {warning ($ (this) .text ());});}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Table & gt; & Lt; Tbody & gt; & Lt; Tr & gt; & Lt; Td> Words like endless rain in a paper cup & lt; / Td> & Lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td> They sloppy, while they \ & lt; / Td> & Lt; Td> They slip into the entire universe & lt; / Td> & Lt; / Tr & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

There is a problem with this code that you .live False - This should be said directly to the selector:

  $ ('table tr'). Live (/ * ... * /)  

From:

DOM traversal methods are not fully supported for finding elements. Instead, the .live () method should always be called directly after the selector

Next, on jQuery 1.4.2, it is probably better to use:

< Pre> $ ('table'). Representative ('tr', 'click', function () {/ * ... * /});

Comments