can you send the html too?
. 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
Even simpler:
$('img.thumb').click(function () {
$(this).toggleClass('dim');
});
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'];
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
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
.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
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
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
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
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,
, 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
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
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
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
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,
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
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
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
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
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
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
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
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,
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
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.
@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
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
@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
...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 =
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
.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
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
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
of an
object.
Cheers,
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
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
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
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
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
$(#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?
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.
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
[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
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 +=
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(){
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
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
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
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(){
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
());
});
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
@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
@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
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
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:
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
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:
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 =
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
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
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?
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
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');
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 = '';
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
66 matches
Mail list logo