I don't believe you are using livequery in the proper way.  You're
passing an 'each' event, which does not exist here.

In theory, you could do the following:

$("input.item_id").livequery('foo',function(bar) {
alert('nothing happens');
});

In the console, you will see the length of the wrapped set, the number
of inputs with class "item_id".

Check the API again:  http://brandonaaron.net/docs/livequery/#api

Also, $.each method is similar to a for-loop:  http://docs.jquery.com/Core/each


That's a start for sure...

Cheers.

Joe

http://www.subprint.com

On Dec 31, 9:39 am, jjshell <blahblahcoui...@gmail.com> wrote:
> The problem seems to be located around these parts:
>
> var CheckedIDs = [];
> $("input.item_id").livequery('each',function(add) {
>       if (this.checked){
>        alert('push');
>        CheckedIDs.push($(this).attr("value"));
>      }
>
> });
>
> On 31 déc, 15:26, jjshell <blahblahcoui...@gmail.com> wrote:
>
> > Thanks for your reply :)
>
> > I only get the alert nothing selected though... Tried to go through
> > the code, couldn't find what is wrong...
>
> > Regards,
>
> > -jj.
>
> > On 31 déc, 14:51, MorningZ <morni...@gmail.com> wrote:
>
> > > Not sure if it's the *best* way, but it works
>
> > > I'd do something like
>
> > > var CheckedIDs = [];
> > > $("input.item_id").each(function() {
> > >       if (this.checked) { CheckedIDs.push($(this).attr("value")); }});
>
> > > if (CheckedIDs.length == 0) {
> > >      alert("Nothing selected!");}
>
> > > else {
> > >      $.post(
> > >           "delete.php",
> > >          item_ids: CheckedIDs.join(","),
> > >          function(data) {
> > >               //Handle the returned results
> > >          }
>
> > > }
>
> > > "delete.php" will see a comma delimited string of IDs to delete
>
> > > On Dec 31, 7:11 am, jjshell <blahblahcoui...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > I have a tabular data I need to be able to delete by selecting
> > > > checkboxes, and submitting a form (a .php script then checks which
> > > > checkboxes have been submitted, delete by id, return an updated list
> > > > of the items injected into the dom).
>
> > > > My problem is that I currently can't manage to gather these checkboxes
> > > > values as an array.
>
> > > > Please consider the below code:
>
> > > > $(document).ready(function(){
>
> > > >     //submit the form
> > > >     $("form#form-delete").livequery('submit', function(event){
> > > >       $("span#wait").html('<img name="wait" src="wait.jpg" />');
> > > >       $.post("delete.php",{
> > > >               item_id: $(".item_id").val(),
> > > >         },function(data){
> > > >         $("span#wait").html('');
> > > >         $("div#view-items").html(data);
> > > >       });
> > > >       return false;
> > > >     });
>
> > > > });
>
> > > > And the html:
>
> > > > <input name="item_id" class="item_id" value="1" type="checkbox">
> > > > <input name="item_id" class="item_id" value="2" type="checkbox">
> > > > <input name="item_id" class="item_id" value="3" type="checkbox">
> > > > <input name="item_id" class="item_id" value="4" type="checkbox">
> > > > //etc.
>
> > > > What would be the ideal jQuery way to handle checkboxes?
>
> > > > Thanks in advance for your time :)
>
> > > > Regards,
>
> > > > -jj.- Masquer le texte des messages précédents -
>
> > > - Afficher le texte des messages précédents -- Masquer le texte des 
> > > messages précédents -
>
> > - Afficher le texte des messages précédents -

Reply via email to