[jQuery] Re: Port Prototype Code to jQuery?

2009-09-01 Thread Josh Powell
can you send the html too?

[jQuery] Re: event-binding to dynamically created elements... (JSP vs JS problem......)

2009-08-30 Thread Josh Powell
. When you have a list of similiar items doing the same thing, give them all the same class or custom attribute and let jQuery do the iterating for you. Josh Powell On Aug 30, 12:37 am, Michael Geary m...@mg.to wrote: Something I forgot to mention in my previous reply... To make sure it's clear

[jQuery] Re: event-binding to dynamically created elements... (JSP vs JS problem......)

2009-08-30 Thread Josh Powell
Even simpler: $('img.thumb').click(function () { $(this).toggleClass('dim'); });

[jQuery] Re: event-binding to dynamically created elements... (JSP vs JS problem......)

2009-08-30 Thread Josh Powell
kali - here is a way to accomplish the same thing in less code, and lets you call the images anything you want instead of having to use numbers. This is untested so there may be some slight errors, but the logic should be sound: $(function() { var imageArray = ['foo', 'bar', 'baz'];

[jQuery] Re: event-binding to dynamically created elements... (JSP vs JS problem......)

2009-08-30 Thread Josh Powell
sorry .up() is prototype... should be .parent() instead. On Aug 30, 1:20 pm, Josh Powell seas...@gmail.com wrote: kali - here is a way to accomplish the same thing in less code, and lets you call the images anything you want instead of having to use numbers.  This is untested so there may

[jQuery] Re: empty() is very slow

2009-08-28 Thread Josh Powell
Change the onclick event handler into a jQuery .live() event and you'll be fine for sure. On Aug 26, 1:57 pm, oleOhle mohleme...@googlemail.com wrote: OK, thanks everybody! I think I understand. Actually my second attempt could easily be rewritten to match exactly what jQuery does. It really

[jQuery] Re: empty() is very slow

2009-08-26 Thread Josh Powell
.empty and .html looks in every node that it removes/replaces and checks for and removes event bindings in order to prevent memory leaks. If you know you do not have bound events, first use plain old javascript to set element.innerHTML = ''; and then remove/replace the element using

[jQuery] Re: Live() event doesnot refresh the class of the event which was changed dynamically.

2009-07-05 Thread Josh Powell
a comparison against the selector every time the mouse moves over an element on the page. This can cause some dramatic slowdowns, especially if you are using multiple live events of these types. It's often better to use regular events for mouseover, mouseout, and mousemove. Josh Powell On Jul 5, 9:21 am

[jQuery] Re: Array to JSON?

2009-06-22 Thread Josh Powell
That's okay, javascript doesn't have associative arrays, only arrays with object properties. On Jun 22, 2:45 pm, Ricardo ricardob...@gmail.com wrote: before someone complains: that function won't handle arrays (only objects) On Jun 22, 6:39 pm, Ricardo ricardob...@gmail.com wrote: Usually

[jQuery] Re: Using Zend IDE with jquery

2009-06-13 Thread Josh Powell
zend with eclipse has some plugins. I don't use them though, so I'm not sure where to get them. On Jun 12, 2:13 pm, Arun arun5672...@yahoo.com wrote: Hi, Has anyone ever tried using the zend ide with jquery? Any comments on this would be appreciated. Arun

[jQuery] Re: Any way to make an anonymous function die?

2009-06-03 Thread Josh Powell
I think you are looking to namespace the event. $(selector).live('click.ns'); $(selector).die('click.ns'); The die() will only remove the click that occurs with that namespace and leave other click events alone. On Jun 2, 12:07 pm, Laker Netman laker.net...@gmail.com wrote: On Jun 2, 1:59 pm,

[jQuery] Re: What happen with jQuery? Is it slow?

2009-05-23 Thread Josh Powell
, then the method should be pulled out and tested individually, if you are trying to test the pattern then you should test the most efficient patterns for each method. On May 22, 10:35 pm, RobG rg...@iinet.net.au wrote: On May 23, 6:48 am, Josh Powell seas...@gmail.com wrote: [...] Also, many

[jQuery] Re: What happen with jQuery? Is it slow?

2009-05-22 Thread Josh Powell
One of the areas of the comparison where jQuery fares the worst is destroy. jQuery checks every element it is removing to see if there are events bound to it and removes those events because they can cause memory leaks. None of the other libraries do this. I do wish that jQuery provided a

[jQuery] Re: jQuery, MooTools, and Prototype - A Comparison

2009-05-21 Thread Josh Powell
What do you want to use the library for? Selecting DOM Elements DOM Manipulation Simplifying Events Simplifying Ajax Mimicking classical inheritance Extending native objects with 'missing' capabilities Cool Widgets From what I can tell, these are the main areas of focus of all the major

[jQuery] Re: question about getJSON, objects and/or scope - confused

2009-05-19 Thread Josh Powell
the document.write() will already have executed and thisStory.title won't exist yet. Josh Powell On May 19, 2:22 pm, illovich illov...@gmail.com wrote: Hi, I'm working on a page where graphics/content get loaded via server side stuff and decided to try to use JSON to send the data. But I'm having trouble

[jQuery] Re: Best book to learn jQuery?

2009-05-19 Thread Josh Powell
The Definitive Guide is a great reference book, and a terrible book to learn javascript from. Javascript: The Good Parts is a must read to understand the prototypical nature of javascript, learn about jslint, and understand == vs === I can't speak to Learning Javascript On May 19, 6:15 pm,

[jQuery] Re: I'll Donate $20USD to Jquery if you can teach me how to do this

2009-05-18 Thread Josh Powell
If you aren't forced to use XML, look at trying JSON instead. It is a MUCH friendlier format for passing information around. On May 17, 11:09 pm, KrushRadio - Doc drega...@gmail.com wrote: Paypal Transaction ID: 8PY233604R986225R :D Thanks for your help. Actually, there were 2 parts that I

[jQuery] Re: Best book to learn jQuery?

2009-05-18 Thread Josh Powell
at: http://javascript.crockford.com/ Josh Powell On May 18, 12:37 pm, alex boba...@googlemail.com wrote: Ah. I'm sure this sounds dunce-y because 'jQuery does it for me', but is a solid grounding in Javascript necessary to a solid grounding in jQuery (or at least, being able to use jQuery

[jQuery] Re: The jQuery Object, Namespaces, and Program Modules -- Connecting the Dots Between jQuery and Javascript

2009-05-05 Thread Josh Powell
Try this: http://www.learningjquery.com/category/levels/beginner?order=ascending On May 5, 9:08 am, kiusau kiu...@mac.com wrote: On May 5, 8:24 am, Rey Bango r...@reybango.com wrote: Great advice Matt. But, no source! Roddy

[jQuery] Re: Jquery and Other Libraries Error

2009-04-26 Thread Josh Powell
code. Josh Powell On Apr 26, 7:42 am, Sparky12 timo...@gmail.com wrote: Problem is that I read thehttp://docs.jquery.com/Using_jQuery_with_Other_Libraries - and i use jQuery now ? So not sure why its occurring? P.S - About code - i dont even use my own code. I just use this plugin and jquery

[jQuery] Re: Alternate $.load

2009-04-23 Thread Josh Powell
It would be much easier to generate a json response instead of html and use .getJSON and then the DOM insertion functions to generate the html you need on the page. On Apr 23, 1:41 am, Colonel tcolo...@gmail.com wrote: This isn't entirely correct, and not quite what I had. For example I have a

[jQuery] Re: jQuery Ajax Error in Firefox 3.0.8

2009-04-22 Thread Josh Powell
what does ajax.php return? at what stage is the error, beforesend, error, success, complete? Put in a console.log and see if it is executed in each of the states. Just a style suggest, but reverse your usage of quotes: $('#searchresult').html('div align=center valign=middle

[jQuery] Re: jquery-1.2.6.min.js and mootools.v1.1.js not compatable

2009-04-20 Thread Josh Powell
http://docs.jquery.com/Core/jQuery.noConflict On Apr 20, 12:54 pm, amanj amanji...@gmail.com wrote: Hi All, i have a problem with web page, i have 2 js files for tow topic jquery-1.2.6.min.js mootools.v1.1.js those file are not compatable togeher, please if have any thing or any problem

[jQuery] Re: Any benefit to using event.preventDefault() over return false to cancel out an href click?

2009-04-20 Thread Josh Powell
It sounds like John is saying that e.preventDefault() will prevent the default event from occuring and e.stopPropogation() will prevent the event from bubbling up and return false will do both, so If you only want to stop the default but allow propogation or vice versa, then use the methods,

[jQuery] Re: Append before closing tag

2009-04-19 Thread Josh Powell
Below is the call and where the code passed into the call would place the content. $('#aP').before(); p id=aP $('#aP').prepend(); lorem ipsim dolor sit amet... $('#aP').append(); /p $('#aP').after(); On Apr 18, 11:49 pm, MauiMan2 cmzieba...@gmail.com wrote: Does jQuery provide a way to append

[jQuery] Re: Questions about $.live, Live Query and performance

2009-04-19 Thread Josh Powell
Geoff - Selectors do make some difference, they always do, but the way I've heard that .live() works is to add an event handler on the document root and when events bubble up to it, doing some javascript mojo to detect what element that event happened on and seeing if it matches the selector.

[jQuery] Re: Creating custom attributes in html

2009-04-16 Thread Josh Powell
@all - So far, the only reasons I've heard not to add custom attributes are 1) Dogma, 2) May cause quirks mode. In my mind, the benefits gained by using custom attributes: less code, simplicity, and clarity, far outweigh these two reasons not to do it. @Jack K - Thanks for the links :). I

[jQuery] Re: Creating custom attributes in html

2009-04-16 Thread Josh Powell
16, 12:06 pm, Kean shenan...@gmail.com wrote: @Josh Powell - string concatenation is plenty fast 99% of the time and a lot more readable. Yes string concatenation is more readable and 99% faster for normal usage. But looping and concatenate a huge chunk in this particular case is slower. Reason

[jQuery] Re: Creating custom attributes in html

2009-04-15 Thread Josh Powell
@all - thank you for your comments. What I've learned is 1) custom attributes are referred to as DOM Expandos, 2) they can cause IE to go into strict mode, 3) Developers often override the class or id of an element to store data instead of using a DOM Expando, and 4) There is a bug in jQuery

[jQuery] Re: Calling a function from a non-jQuery .JS file

2009-04-15 Thread Josh Powell
...what is wrong with just having:- var todayEl = document.getElementById(today); todayEl.innerHTML = formatDate(new Date); document.ElementById has a bug in ie6 and ie7 that will return an element with a name attribute of the same value. Use $('#today') instead. todayEl.innerHTML =

[jQuery] Re: Creating custom attributes in html

2009-04-14 Thread Josh Powell
I cannot use .data() as I do not have a node. Creating a node for every td creates impossibly excessive append time. One one page I shortened the time to append for 500 table rows from 29,000ms to 900ms. Good to know about the potential for triggering quirks mode though, thanks. Josh Powell

[jQuery] Re: Difference between .bind() and .click()

2009-04-06 Thread Josh Powell
.bind enables you to pass variables into the callback function via the e.data attribute in the event. $(document).bind('click', {'foo': 'bar'}, function(e) { console.log(e.data.foo); }); Can't do that with the .click shortcut. Josh Powell On Apr 6, 9:53 am, jQueryAddict jqueryadd

[jQuery] Re: Need to get value of table cell

2009-03-25 Thread Josh Powell
alert($(this).html()); // to get the full html inside instead } ); Find more on selectors at: http://docs.jquery.com/Selectors and more on the .text() .html() at: http://docs.jquery.com/Manipulation and more on the .get(1) at: http://docs.jquery.com/Core Cheers, Josh Powell On Mar 25

[jQuery] Re: How to call jQuery function inside a DOM

2009-03-21 Thread Josh Powell
While not what you were asking, remember that you can chain. var name = $(#label); var nameInfo = $(#nameInfo); name.blur(validateName).keyup(validateName); ... nameInfo.text(We want names with more than 3 letters!).addClass (error); Then: $('#addPhoneExt').click(tb_remove); sets an onclick

[jQuery] Re: getJSON() response into a table

2009-03-21 Thread Josh Powell
of an object. Cheers, Josh Powell

[jQuery] Re: Preventing A link clicks before document.ready();

2009-03-20 Thread Josh Powell
You could also put the .click events inside a document.ready(). Then they can click away, but no results until the event handler is set after document.ready. On Mar 20, 12:30 pm, James james.gp@gmail.com wrote: That's the default of how web browsers. You can work around it such as by

[jQuery] Re: jQuery and Prototype conflict

2009-03-20 Thread Josh Powell
In this: jQuery(document).ready(function($){ $(#example).autocomplete(options); }); this: function($) { }) is overwriting the $ for prototype. It should be: jQuery(document).ready(function(){ $(#example).autocomplete(options); }); without passing the

[jQuery] Re: jquery each help

2009-03-15 Thread Josh Powell
read up on the .animate() jQuery effect, this might be what you are looking for. http://docs.jquery.com/Effects/animate On Mar 15, 11:46 am, Tom Shafer tom.sha...@gmail.com wrote: I have articles in a group of divs div class=art                         div id=leftMainimg

[jQuery] Re: jQuery each problem

2009-03-15 Thread Josh Powell
could and cannot find answer to my question: how to I know if user clicked on button Yes or button No Any other ideas ??? Thanks in advance Jean from France On 14 mar, 17:54, Josh Powell seas...@gmail.com wrote: $(this).is(eq[0]) will not work because, is looks at the list

[jQuery] Re: jQuery each problem

2009-03-14 Thread Josh Powell
Thanks for help Jean from France On 14 mar, 00:57, Josh Powell seas...@gmail.com wrote: What this is doing: jQuery('.choix1').click(function(){   jQuery('#quest1').hide(); }); is looping through every element on the page with a class of 'choix1', so you could either change all

[jQuery] Re: Using nbsp; (or not!)

2009-03-14 Thread Josh Powell
$(#msgUnits).text(nbsp;); will definitely not work. nbsp; is not the name of a javascript object. On Mar 13, 9:46 pm, Swatchdog scott.swatch...@gmail.com wrote: This does not work: $(#msgUnits).text(nbsp;); nor does this... $(#msgUnits).text('nbsp;'); I guess nbsp; is html only?

[jQuery] Re: Please help me SPEED UP my dev. MySQL = PHP = JSON = AJAX = jQueryUI

2009-03-14 Thread Josh Powell
No, JSON is the correct route. If you are using ajax to retrieve json, then you can pull the json into a javascript object immediately. If you are using PHP to generate pages, then you can print out the JSON object as a string directly into javascript and create javascript objects that way.

[jQuery] Re: jQuery each problem

2009-03-14 Thread Josh Powell
can use jQuery('.choix').click(function(e) { $(this).parent().parent().hide(); and it will go 2 levels up instead of one as described in you solution Thanks to great people like you Josh I am learning ( slowly) Many thanks Jean from France On 14 mar, 08:27, Josh Powell seas...@gmail.com

[jQuery] Re: find among same elements using name

2009-03-14 Thread Josh Powell
[name=row] On Mar 14, 10:58 am, Alain Roger raf.n...@gmail.com wrote: Hi, i have a table with checkboxes which allows user to select all row/records or none. they have all the same name : row i would like to know if there is an easy way to find them in my table ? i was thinking about

[jQuery] Re: .getJSon

2009-03-14 Thread Josh Powell
Because it puts it in the javascript and lets you easily manipulate it with javascript. If you get html back from the server, it's more difficult to manipulate. $.getJson('path/to/url', function(data) { var tableHTML = 'table'; $.each(data.aaData, function() { tableHTML +=

[jQuery] Re: Very New To JavaScript\JQuery - Mouseover and Mouseout Question

2009-03-14 Thread Josh Powell
The problem is this: $(.block a).mouseover(function(){ $(.block a).animate({ $('.block a') gets every instance of an a element with class block. So when you do the .animate on it, you are animating every element. Instead, you mean. $(.block a).mouseover(function(){

[jQuery] Re: .getJSon

2009-03-14 Thread Josh Powell
to code. On Mar 14, 2:10 pm, donb falconwatc...@comcast.net wrote: Then I must be missing something: $(#placetoinsert).load(path/to/url); would do the same thing, with the tableHTML constructed on the server side. On Mar 14, 5:02 pm, Josh Powell seas...@gmail.com wrote: Because it puts

[jQuery] Re: triggering events with selected option

2009-03-13 Thread Josh Powell
select name=numberPages class=numberPages option1/option option2/option option3/option option4/option option5/option /select/p p class=foocontent/p p class=foocontent/p p

[jQuery] Re: Invalid Argument in IE7/8

2009-03-13 Thread Josh Powell
Where does this error come from? [cycle] terminating; zero elements found by selector You can see it when the page loads on the firebug console, but it doesn't give a file name or line number. it may be that since you aren't getting any elements back, IE is messing up because you are trying to

[jQuery] Re: jQuery each problem

2009-03-13 Thread Josh Powell
What this is doing: jQuery('.choix1').click(function(){ jQuery('#quest1').hide(); }); is looping through every element on the page with a class of 'choix1', so you could either change all of the elements you want to loop though classes to choix and then do jQuery('.choix').click(function(){

[jQuery] Re: $(byName) $(byClass) in 1.3.2

2009-03-12 Thread Josh Powell
htmlText = 'a class=\'widgetBasSelector basic\'Hola!!/adiv class=pp name=div1/div'; Josh Powell On Mar 12, 6:10 pm, Karl Rudd karl.r...@gmail.com wrote: Use id=whatever rather than name=whatever. In CSS #whatever refers to an element with id=whatever. The name attribute is for form elements

[jQuery] Re: Get Textbox-value and write to table-cell (td/td)

2009-03-11 Thread Josh Powell
()); }); I personally find this kind of string munging difficult to read and maintain. Could just be personal preference though. Good luck. Josh Powell On Mar 10, 10:39 pm, Eric Gun gunawan.e...@gmail.com wrote: @mkmanning: Well done!! Your script works well. Thanks, and great job! :) @brian-263

[jQuery] Re: Order Items. Please help me. Thank You.

2009-03-11 Thread Josh Powell
@mkmanning An even more important performance gain can be had by not doing string concatenation (I put a caveat about this in the code comment's also), but build an array of your html and then join the array; it's siginficantly faster. Funny that you mention this. In current browser

[jQuery] Re: Very simple question...

2009-03-11 Thread Josh Powell
@7times9 I'm not sure what eq() stands for, come to think of it, but I always read it in my heads as 'equals' as in the index equals 2. On Thu, Mar 12, 2009 at 10:04 AM, 7times9 7tim...@googlemail.com wrote: ...what does eq as in .eq(2) stand for? It helps me to read jQuery in my head if

[jQuery] Re: display children using jQuery

2009-03-07 Thread Josh Powell
Long answer: Check out the section on Traversing in the jquery documentation on the site. Lots of good examples and documentation on there. Short answer: console.log($(element).children())); On Mar 7, 1:33 am, Alain Roger raf.n...@gmail.com wrote: Hi, i need to debug jQuery code and i

[jQuery] Re: Get Textbox-value and write to table-cell (td/td)

2009-03-07 Thread Josh Powell
Why do you have the [] characters in the name of the elements? That might screw up selectors. Another options is to give the dealAmount inputs a new attribute with a value of an incrementing numbers, foo=0 say. As long as the post amounts are in the same order you could:

[jQuery] Re: Get Textbox-value and write to table-cell (td/td)

2009-03-07 Thread Josh Powell
6 of one... half dozen of another... On Mar 7, 12:04 pm, brian bally.z...@gmail.com wrote: On Sat, Mar 7, 2009 at 2:16 PM, Josh Powell seas...@gmail.com wrote: Why do you have the [] characters in the name of the elements?  That might screw up selectors. PHP, likely. But there's no need

[jQuery] Re: can't get started

2009-03-05 Thread Josh Powell
Did you mean to: script src=jquery-1.3.2.js type=text/javascript/script instead of script src=jquery-1.2.3.js type=text/javascript/script On Mar 5, 3:37 pm, dawnerd dawn...@gmail.com wrote: Can you please post the html you were using? On Mar 5, 2:32 pm, Dr G michaelg...@gmail.com wrote:

[jQuery] Re: How to create dom on the fly using jQuery????

2009-03-04 Thread Josh Powell
Simple answer: DOM nodes are created by just writing the html in side of the jQuery $('#divName').append('tabletrtd/td/tr/table'); is equivalent to divResult = document.getElementById(divName); table = document.createElement(table); tr = document.createElement(tr); td =

[jQuery] Re: $.getJSON

2009-03-02 Thread Josh Powell
Using console.log and firebug will show you what everything is. console.log(data); $.each(data.records, function(i,item){ console.log(i); console.log(item); console.log(this); }); On Mar 2, 1:54 am, Alain Roger raf.n...@gmail.com wrote: On Mon, Mar 2, 2009 at 10:52 AM, Matt

[jQuery] Re: Optimize large DOM inserts

2009-03-02 Thread Josh Powell
Hey guys, This thread inspired me to write a blog article http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly I did some testing of the += and array.join methods of long string concatenation. Interesting stuff! It turns out that += and array.join are browser dependent

[jQuery] Re: I can't figure out how to implement JQuery into my website

2009-03-01 Thread Josh Powell
It's just a javascript file, put it wherever you put your javascript files. On Mar 1, 12:20 pm, Warfang warfang...@gmail.com wrote: What code do I need to put in my HTML header? I have already downloaded the JQuery code from JQuery's homepage to my computer, but where exactly do I put that?

[jQuery] Re: Multiple inclusions of jquery possible?!?

2009-02-27 Thread Josh Powell
http://groups.google.com/group/jquery-dev/browse_thread/thread/3efd1066b535234f On Feb 27, 3:19 pm, ml1 tsummer...@gmail.com wrote: Hi folks: We use jquery extensively in an application that suddenly needs to make use of an online ecommerce system that also happens to use jquery. This

[jQuery] Re: Help please with toggling a class

2009-02-27 Thread Josh Powell
Without really understanding what your fadeToggle plugin is doing, this will toggle adding and removing a class: $(function() { $('a.aboutlink').toggle( function () { $(this).addClass('aboutBox');

[jQuery] Re: alternate color row starting from a point

2009-02-27 Thread Josh Powell
hmmm, tough one, it was fun. $(function() { var color = ''; $('#everyother tr').each(function() { if( $(this).hasClass('className') ) { color = 'red'; } else if (color === 'red') { $(this).css({'background-color': 'red'}); color = '';

[jQuery] Re: Help please with toggling a class

2009-02-27 Thread Josh Powell
oh, very nice. I wasn't aware of toggleClass. On Feb 27, 6:51 pm, Karl Swedberg k...@englishrules.com wrote: Hi Zac, You just need to add one line -- $(this).toggleClass('yourClass'); --   where yourClass is the class you want to toggle on and off. You should also add return false after