Skip to content Skip to sidebar Skip to footer

Jquery In Phonegap

This is my entire code Enable or Disable Agents

First I would add a class and rel to the input's your creating, so they would look something like this:

<input  class="agent-checkbox" rel="123456" type="checkbox" checked />

This will allow you to drastically simplify what it takes to determine what agent is and isn't enabled.

This I would update your getCheckedRow() function to be the following...

 function getCheckedRow() {
        //loop through all elements with agent-checkout class
        $('.agent-checkbox').each(function(){
            //call the function passing the id via the rel and a boolean if checked or not
            enableDisableInDatabase( $(this).attr('rel'), (  $(this).is(':checked')  ) );
        });
    }

And lastly, I would make a small mod to the function enableDisableInDatabase() function to accept the a_id from the getCheckedRow() function, like this:

function enableDisableInDatabase(a_id, enabled) {}

Below is a link to a gist that I created to show you an example of how it all work together.

https://gist.github.com/anonymous/6f36b242e9d7ebee3b56

Good luck. I hope this helps and makes sense.


Solution 2:

Change your button event handler to onClick="getCheckedRow"

I think getCheckedRow() will evaluate to onClick="return false;"


Post a Comment for "Jquery In Phonegap"