Is this $(document).delegate code written correctly?

I have this code just before my </body> tag:

<script type=“text/Javascript”>

function() { persistData($(this));


It is supposed to execute the persistData() function, which saves the data typed into the fields. Can you tell me if this is written correctly? The code is not saving the data presently. The page correctly links to the external js page that executes this function.

Purpose for this script: I want to avoid as many buttons as possible in this iPhone app page, and I thought this would get rid of yet another button with an onClick function.

The code seems to work on a web browser, but as for developing for the iPhone I have no way to confirm or not.

Perhaps someone in our Developing for Mobile Devices forum might be able to shed some more light on this.

The following link may help you

Thanks, Paul. I’m not getting any errors in Chrome for this, so the problem must be elsewhere. (I’m not getting ANY errors, so that’s a real problem!)

Thanks, Chris, but I don’t see your link’s relevance to my case.

It may be worth noting though that as of jQuery 1.7, .delegate() has been superceded by [url=“”].on()

For example:

$(document).on("change", "textarea,select,input[type='text']", function() {