[jQuery] Re: abort an animation?
You can call .stop() to stop an animation, and .css('opacity', 1) to remove transparency. Cheers, Jesse Skinner www.thefutureoftheweb.com On Sat, Jan 17, 2009 at 11:13 AM, Stephan Veigl stephan.ve...@gmail.comwrote: How can I abort an animation? I have a slow fadeOut() on an element. Under some conditions I would like to stop the fadeout and show the element without any transparency. How can I do this? Stephan
[jQuery] Re: Can I override ui.draggable?
You can attach data to each draggable HTML element (eg. a big div or table) using the .data() jQuery function. Then when an element is dropped, you can use .data() again to retrieve the object attached to it and use that data for processing/saving/etc. I hope that helps. Cheers, Jesse Skinner www.thefutureoftheweb.com On Fri, Jan 16, 2009 at 11:13 PM, alphadog alphad...@gmail.com wrote: So, if I understand correctly, when I create a droppable, and it gets triggered by a draggable, the drop callback gets access to the draggable via ui.draggable. ui.draggable seem to wrap up the child tags of whatever tag got labeled as a draggable. This works well if you are dragging one tag, not so well if you want to drag complex data represented by a big div or table. Is there a way to somehow override ui.draggable? Ideally, I'd like the drop to see a JSON object instead of a messy pile of HTML.
[jQuery] Re: simple Jquery Ajax XHR async request for XML and JSON please
I am looking for some basic examples showing how to do simple XHR's with both XML and JSON datatypes. How do you parse the XML vars using Jquery? I am looking for simple examples that I can learn from. Just use the $.ajax function, and set the dataType option like this: $.ajax({ url: 'ajax.php', dataType: 'xml', success: function(xml) { // do something with XML document with DOM functions var items = xml.getElementsByTagName('item'); } } You can see the documentation of the $.ajax function here: http://docs.jquery.com/Ajax/jQuery.ajax#options Jesse www.thefutureoftheweb.com
[jQuery] select value lost after clone in IE
It seems that after a jQuery clone(), the value of select boxes are lost in IE (but not Firefox). Try this out: div select option value=0one/option option value=1 selected='selected'two/option /select /div $(function(){ $('div').clone(true).appendTo('body'); }); The first option will be selected in the cloned select. Doing something like this fixes the problem (as long as there is only one select box), though I suspect there needs to be a better fix in jQuery explicitly: $(function(){ var old = $('div'); var clone = old.clone(true); var select_val = $('select', old).val(); $('select', clone).val(select_val); clone.appendTo('body'); }); Cheers, Jesse www.thefutureoftheweb.com
[jQuery] Re: XML Problems
I'm having problems using jQuery to manipulate XML documents (response from Ajax queries). I wonder if anyone can tell me what the problem is or where I'm going wrong. I've setup a page with tests here: http://www.fyneworks.com/jquery/jQuery-XML-Problems/ For Test #3, your result area ID is wrong - you have 2 Result2 divs and no Result3 div. For Test #5, you are trying to do this: n = $('test', $('divemPassed!/em/div')); which, of course, doesn't return any elements - there is no 'test' tag in the string you passed. Perhaps you meant to do this: n = $('test', $('divtestPassed!/test/div')); I hope that helps. Cheers, Jesse Skinner http://www.thefutureoftheweb.com/
[jQuery] Re: Multiple .bind
I've just submitted a patch to fix this, but in the meantime you can use an anonymous function (as I just described in another message) like so: function tocDisplay(e){ $('#toc_content')[e.data.mode](); } $('#toc_header').bind('click', {mode: 'toggle'}, function(e){ tocDisplay(e); }); $('#toc_content a').bind('click', {mode: 'hide'}, function(e){ tocDisplay(e); }); -- Jesse Skinner http://www.thefutureoftheweb.com DaveG wrote: I'm binding a click function. If I include either one of the binds it works -- so the syntax and object references are correct. If I include both binds they do not work. No errors, they just don't trigger. function tocDisplay(e){ $('#toc_content')[e.data.mode](); } $('#toc_header').bind('click', {mode: 'toggle'}, tocDisplay); $('#toc_content a').bind('click', {mode: 'hide'}, tocDisplay); Is there a problem binding the same function to multiple objects? ~ ~ Dave
[jQuery] Re: Building HTML and binding to an inner element.
I just submitted a patch for this bug. As a temporary workaround, you could fix this by using an anonymous function wrapper, like so: el.bind('click', data, function() { return my_func.apply(this, arguments); }); or in the context of your example: $( li style=\display: none\+ [+task.client.code+] +task.project.name+ br/+task.name+br/+ a class='removeTask' href='#'Remove/a+ /li ).find(a.removeTask).bind('click', {taskid: task.id}, function(){ return remove_task.apply(this, arguments); }).end().appendTo(#actSessionList); Hope that helps. Cheers, -- Jesse Skinner http://www.thefutureoftheweb.com dec wrote: On Apr 17, 8:22 pm, dec [EMAIL PROTECTED] wrote: Hi list, I'm trying to add items to an unordered list using jQuery. This is something triggered by another event, so it cannot be done within my HTML templating engine whilst building the page. I also wish to add an 'a' element within the list item which I can then use to remove the item and post an AJAX request at a later point. I had come up with the following with some assistance on #jquery: $( li style=\display: none\+ [+task.client.code+] +task.project.name+ br/+task.name+br/+ a class='removeTask' href='#'Remove/a+ /li ).find(a.removeTask).bind('click', {taskid: task.id}, remove_task ).end().appendTo(#actSessionList); My understanding is that this should: build the HTML, find any elements matching 'a.removeTask' within that HTML and bind them to remove_task() passing taskid within event.data and then add the initial HTML to my unordered list (#actSessionList). This seems to work fine when I call it the first time, but for any subsequent calls (with new data in the 'task' variable), the .bind(...) call overwrites the binding of the previous items and causes all their 'Remove' links to call remove_task with the wrong value of task.id. Is this incorrect behavior for the code I've written or am I not grasping the concept completely? My initial thought is that I'm not being explicit enough when selecting the 'a' element to _only_ receive the single element within that list item, but I'm too new to JavaScript to know how to debug this. Any help or comments are much appreciated. Regards, Tom Ah hah, just discovered that this is a bug! (http://dev.jquery.com/ ticket/935) So I'm not crazy after all... well maybe just a little... :) -Tom
[jQuery] jQuery tutorial on IBM DeveloperWorks
I wrote a jQuery tutorial for IBM DeveloperWorks which went live today: http://www.ibm.com/developerworks/library/x-ajaxjquery.html Cheers, Jesse Skinner www.thefutureoftheweb.com