[jQuery] Modifying element on drop into sortable list

2009-05-03 Thread Sam Hastings

Hi everyone,

I've got a Draggable list working in conjunction with a Sortable list.
When I drag an item from the draggable to the sortable list I want to
modify the contents of the list. The code I'm using right now is:

$("#list li").draggable({
   connectToSortable: "#page ol",
   containment: "window",
   helper: "clone",
   revert: true,
   revertDuration: 0,
   appendTo: "body"
});

$("#page ol").sortable({
   handle: ".drag_handle",
   receive: function(event, ui) {
  $(ui.item).css('background','red');
   }
});

Instead of modifying the dropped element it actually modifies the
source element in the draggable list. I've tried using ui.helper
instead of ui.item but this has no effect whatsoever.

Can anyone suggest a different way of going about this? Thanks in
advance!

Sam


[jQuery] Re: Adding an LI element to an OL

2009-02-10 Thread Sam Hastings

Hi Michael,

Thanks for replying.

The sort won't need to be done very often at all so I imagine that
your solution would be ideal. Having a bit of trouble getting it to
work though:

$("#group_add").livequery('submit',function() {
var group_name = $(this).children("#group_title").val();
var myvar = 'hello';
var group_array = [];
if(group_name != '') {
$("#group_list").children("li").each(function() {
group_array[] = this.text();
});
group_array[] = group_name;
group_array.sort();
alert(group_array);
}
return false;
});

It seems like the function called by each() can't access the
group_array[] array. How do I change the scope of group_array to allow
me to add elements to it within my each() function? Or is there a
better way of going about it?

Sam

On Feb 10, 8:51 pm, Michael Lawson  wrote:
> How often are you going to be doing this sort?
>
> You could just say that when you add something to the list, pull them all
> out and put them into an array, sort the array and then put it back out
> cheers
>
> Michael Lawson
> Content Tools Developer, Global Solutions, ibm.com
> Phone:  1-919-517-1568 Tieline:  255-1568
> E-mail:  mjlaw...@us.ibm.com
>
> 'Examine my teachings critically, as a gold assayer would test gold. If you
> find they make sense, conform to your experience, and don't harm yourself
> or others, only then should you accept them.'
>
>   From:       Sam Hastings                            
>                                      
>
>   To:         "jQuery (English)"                  
>                                      
>
>   Date:       02/10/2009 03:50 PM                                             
>                                      
>
>   Subject:    [jQuery] Adding an LI element to an OL                          
>                                       
>
> Hi everyone,
>
> I've got an ordered list (OL) containing several LI items, currently
> arranged in alphabetical order.
>
> How hard would it be to create a new LI element, and put it in the
> right alphabetical position based on its value?
>
> Sam
>
>  graycol.gif
> < 1KViewDownload
>
>  ecblank.gif
> < 1KViewDownload


[jQuery] Adding an LI element to an OL

2009-02-10 Thread Sam Hastings

Hi everyone,

I've got an ordered list (OL) containing several LI items, currently
arranged in alphabetical order.

How hard would it be to create a new LI element, and put it in the
right alphabetical position based on its value?

Sam


[jQuery] Re: Checkbox selection

2009-02-06 Thread Sam Hastings

Thanks! I'll give your suggestions a shot :-)


[jQuery] Checkbox selection

2009-02-05 Thread Sam Hastings

Hi everyone,

I've got an HTML table like this:



Foo
Bar
Baz




What I'd like to do is toggle the checkbox's checked state when any of
the cells in its row are clicked. I've tried this a thousand different
ways and can't get it working and was wondering if someone here would
be kind enough to help.

Many thanks :-)

Sam Hastings


[jQuery] Manipulating form field attributes

2009-02-03 Thread Sam Hastings

Hi everyone,

I'm trying to use the following code to change 
to  where the element has the classname
"navtitle".

$(".navtitle").each(function() {
this.type = "hidden";
});

This code works fine in Firefox but has no effect at all in IE. Can
anyone help me please?

Sam Hastings