[jQuery] Re: How to find a parent

2009-02-28 Thread mkmanning
$(this).parents('div.popup') On Feb 28, 8:47 pm, riotbrrd k...@riotbrrd.com wrote: I have a bunch of Divs with class .popup. Each div is different in what it contains; some are simple, some are pretty complex, containing tables, other divs, etc.. If I have a link, for example,Cancel, within

[jQuery] Re: How to find a parent

2009-02-28 Thread mkmanning
It should be .parents $(this).parents('div.popup:first') On Feb 28, 9:05 pm, Rick Faircloth r...@whitestonemedia.com wrote: Assuming that the cancel link has an id of 'cancel': How about: $(document).ready(function() {      $('#cancel').click(function() {                

[jQuery] Re: How to find a parent

2009-02-28 Thread mkmanning
- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of mkmanning Sent: Sunday, March 01, 2009 12:18 AM To: jQuery (English) Subject: [jQuery] Re: How to find a parent It should be .parents   $(this).parents('div.popup:first') On Feb 28, 9:05 pm, Rick

[jQuery] Re: How to find a parent

2009-02-28 Thread mkmanning
And that's what happens when you type a long-winded response, it becomes redundant by the time you hit send :) On Feb 28, 10:03 pm, mkmanning michaell...@gmail.com wrote: The statement it has a parent div.popup somewhere up the tree (no idea how many levels) implies to me that div.popup may

[jQuery] Re: Using Google's Code Repo

2009-02-27 Thread mkmanning
I've never experienced this myself. We have jQuery loading from the explicit Google URL (https://ajax.googleapis.com/ajax/libs/jquery/ 1.2.6/jquery.min.js) as opposed to the loader (although we're using that on other products) so far with no issues. We get 6 million+ pageviews/month. My guess

[jQuery] Re: Apply class to range of child elements

2009-02-26 Thread mkmanning
It's possible. Here's a more traditional way: $('a').each(function(i,link){ if(i10){$(link).addClass('first');} else if (i9 i20){$(link).addClass('second');} else if (i19i30){$(link).addClass('third');} else if

[jQuery] Re: Apply class to range of child elements

2009-02-26 Thread mkmanning
 am, mkmanning michaell...@gmail.com wrote: It's possible. Here's a more traditional way:         $('a').each(function(i,link){             if(i10){$(link).addClass('first');}             else if (i9 i20){$(link).addClass('second');}             else if (i19i30){$(link).addClass('third

[jQuery] Re: SlideUp/SlideDown Causing Alignment Issues.

2009-02-26 Thread mkmanning
The effects functions apply a style of display:block to the table. Try wrapping the table in a div and slide the div . On Feb 26, 1:36 am, Sir Rawlins robert.rawl...@thinkbluemedia.co.uk wrote: Hello Guys, Take a look at the following example:http://www.coldbeans.co.uk/expanding_table.html

[jQuery] Re: Get all inputs but not a specfic one?

2009-02-26 Thread mkmanning
$('input:checkbox:not(#notwanted)') On Feb 26, 2:39 am, heohni heidi.anselstet...@consultingteam.de wrote: Hi, is there a way to do this: $(input:checkbox    - but not this one id = #notwanted - ).click (function(){ . Thanks a bunch!

[jQuery] Re: HELP: a = $('pfoo/ppbar/p'); a.after('bxyz/b') not adding element

2009-02-26 Thread mkmanning
For those methods to work, the html has to be part of the DOM first. On Feb 26, 3:33 am, stephen stephen.cant...@gmail.com wrote: Hello, has anybody managed to prepend and append elements to a set of dom elements previously created on the fly with the $(html) function? I've tried with

[jQuery] Re: HELP: a = $('pfoo/ppbar/p'); a.after('bxyz/b') not adding element

2009-02-26 Thread mkmanning
Sorry for not being clearer; that's what comes from posting at 3 in the morning :P I was going on the post's title, attempting to use .after(). As Ricardo says, append/appendTo, prepend/prependTo work on newly created nodes, but after/insertAfter, and before/insertBefore require that the nodes be

[jQuery] Re: Apply class to range of child elements

2009-02-26 Thread mkmanning
will evaluate to class 'first', 51 to 'second', 85 to 'first' again and so on. cheers, - ricardo On Feb 26, 6:29 am, mkmanning michaell...@gmail.com wrote: And just as an exercise, here's the 'jQuery' way chained: $('a').filter(':lt(10)').addClass('first').end().filter(':gt(9):lt (10)').addClass

[jQuery] Re: Help for beginners. Inspecting objects.

2009-02-26 Thread mkmanning
If you're going to work with jQuery then all you need to know (assuming you know HTML and CSS, and have a general understanding of JavaScript) is contained in the docs. var list = document.createElement(li); uses a DOM method (not jQuery). The variable 'list' is a DOM node, a way to add text to

[jQuery] Re: Help for beginners. Inspecting objects.

2009-02-26 Thread mkmanning
, mkmanning michaell...@gmail.com wrote: If you're going to work with jQuery then all you need to know (assuming you know HTML and CSS, and have a general understanding of JavaScript) is contained in the docs. var list = document.createElement(li);  uses a DOM method (not jQuery). The variable

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

2009-02-25 Thread mkmanning
You could post to the server with ajax, or since you have all the data server-side, just render the page with the themes array already populated and call the build function On Feb 25, 11:55 am, shapper mdmo...@gmail.com wrote: Hi Michael, It is working fine. Thank You Very Much. Just one

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

2009-02-24 Thread mkmanning
.27lamps.com/Beta/List/List5.html But I keep having errors. What am I missing? Sorry, but I am just starting with JQuery. Thank You, Miguel On Feb 23, 9:23 pm, mkmanning michaell...@gmail.com wrote: That's because you changed levels to an object, which you don't need to. Just use

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

2009-02-24 Thread mkmanning
JQuery creators and Microsoft. This is the reason why I am starting with JQuery but I am still learning ... but until now it seams great. Thanks, Miguel http://www.27lamps.com/Beta/List/List5.html On Feb 24, 4:57 pm, mkmanning michaell...@gmail.com wrote: Creating a complete html string

[jQuery] Re: File Input field Help

2009-02-24 Thread mkmanning
The click event is bubbling, try adding event.stopPropagation() On Feb 24, 1:07 pm, Chris macmichae...@gmail.com wrote: Hello so I am trying to create an image that once clicked will trigger the file input field but I am getting an error Here is what I am doing: # Set the image in the div

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

2009-02-23 Thread mkmanning
= levels.slice(-1);     var friendly = first.join(', ');     if (last) { friendly += ' e ' + last; }       return friendly;   } I am not completely sure that I am doing this right because I get the error before. Thank You, Miguel On Feb 20, 5:02 pm, mkmanning michaell...@gmail.com wrote

[jQuery] Re: problem finding all atributes, attributes length, retrieve all attributes

2009-02-21 Thread mkmanning
Wow, I just uploaded a simple plugin that does this: http://plugins.jquery.com/project/getAttributes and then saw your post. On Feb 21, 9:07 am, RotinPain rotinpain@gmail.com wrote: After searching the web with no answer, I really need some help about attributes in jquery Here's the

[jQuery] Re: Help with Multiple File uploading

2009-02-20 Thread mkmanning
The form has to include enctype='multipart/form-data' On Feb 19, 2:23 pm, Simon sib...@gmail.com wrote: Hello, I am desperately trying to implement the Multiple File Upload Plugin into a script. However, I seem to be having no end of problems simply getting it to pass the files through. I

[jQuery] Re: how to search/replace text nodes?

2009-02-20 Thread mkmanning
Sure, just write a recursive function to walk the DOM and filter text nodes: function traverseDOM(node) { if (node.nodeType == 3 node.parentNode.nodeName!='SCRIPT') { //do something to the text content here } if

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

2009-02-20 Thread mkmanning
then 1 level. How can I do it? Thank You, Miguel - The subject is working fine. - On Feb 20, 1:50 am, mkmanning michaell...@gmail.com wrote: You could modify the subject variable being put into the array to make it an object: subject = {} then add the option's value and text

[jQuery] Re: Creating callable methods, and binding them to objects' actions.

2009-02-19 Thread mkmanning
:04 am, mkmanning michaell...@gmail.com wrote: You shouldn't have to refer to the same object in different ways,  $ (input:[name='donation_type']) will work for both getting the value and binding an event. The @ before the attribute name was deprecated as of version 1.2 On Feb 18, 9:51

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

2009-02-19 Thread mkmanning
with the text in it. http://www.27lamps.com/Beta/List/List3.html Could you, please, help me out? Thank You, Miguel On Feb 18, 5:33 pm, mkmanning michaell...@gmail.com wrote: The problem is with the version of jQuery you're using. Update to 1.3 (and don't include a space in the URI). Try your

[jQuery] Re: can jQuery support drawing items on a CANVAS? (e.g. web-based UML tool)

2009-02-19 Thread mkmanning
Short answer: yes no. I wrote something similar to mochaui in mootools (check it out, it will give you a good idea of what you're in for). You can create canvas tags using jQuery (e.g. var ctx = ($ ('canvas').attr({'width':'500','height':'300'}).css

[jQuery] Re: Using jQuery to Parse XML in AIR

2009-02-19 Thread mkmanning
I suspect it's the dance you're having to do. Quickly testing in a browser, If you use xmlObjectTree = $(data) then you can iterate through the animal tags. Doing the dance in a browser yields an unrecognized expression syntax exception. How did you come to use $($(data).text()); and what

[jQuery] Re: How to surround All content after a specified HTML attribute H2?

2009-02-19 Thread mkmanning
You could also do this: $('h2').after('div class=someclass/div').each(function(){ var _this = $(this); _this.nextAll(':not(div.someclass)').each(function(){ var _that = $(this); if(!_that.is('h2')){_that.appendTo(_this.next());}else{return false;}

[jQuery] Re: Tabs, how to find what kind of object....

2009-02-18 Thread mkmanning
Get Firebug. Not meaning to sound flippant, but debugging with alerts is painful and living in the past. Firebug will allow you to see inside the object by doing console.log($tabs). To save you some frustration, if you try and log a string plus the object to the Firebug console you'll get [object

[jQuery] Re: image rollover

2009-02-18 Thread mkmanning
You can take a slightly different approach, which might simplify your markup, css and js. Since you're using absolute positioning, you can absolutely position your image over your text, then just toggle the opacity on hover to reveal the text underneath. One advantage with this approach is you're

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

2009-02-18 Thread mkmanning
the script after the body?     I am placing the script inside a js file and then I include it in the head of the document. Thanks, Miguel On Feb 18, 7:13 am, mkmanning michaell...@gmail.com wrote: Here's a wholly different approach for consideration. Rather than try and keep track of LI

[jQuery] Re: Traversing

2009-02-18 Thread mkmanning
If you must rely on the markup structure (and you're confident it won't change), then you could use either suggestion (you might want to check for speed), with some minor changes: anytime you find yourself using a selector twice or more ( e.g. .parent().parent().parent() ), then there's most

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

2009-02-18 Thread mkmanning
that to the file and add the include. Anyway, try to add a theme. The first is added but the second not. Or better, I think it is added to the list but not to the page ... Could you tell me what am I doing wrong? Thanks, Miguel On Feb 18, 4:49 pm, mkmanning michaell...@gmail.com wrote

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

2009-02-18 Thread mkmanning
not change ... ... But the index input is on the Html code. I just can't find  the problem. Thanks, Miguel On Feb 18, 5:21 pm, mkmanning michaell...@gmail.com wrote: if you're using the ready function, remove the inner (function($) { ... })(jQuery); wrapper On Feb 18, 9:13 am, shapper mdmo

[jQuery] Re: default value of an object's property

2009-02-18 Thread mkmanning
The method that Josh posted is (in some people's opinion) the preferred method for assigning values, and is sometimes called the 'default pattern' for obvious reasons (the other common form is the guard pattern ). It, along with the ternary, is usually more succinct than if/else, the latter being

[jQuery] Re: Creating callable methods, and binding them to objects' actions.

2009-02-18 Thread mkmanning
try: $(input:[...@id:chargetotal]).change(updateDonationTotal); On Feb 18, 1:55 pm, gberz3 gbe...@gmail.com wrote: Hi All, I'm having a bit of a problem with selectors and binding in jQuery. Basically I want to do 2 things: 1) create a javascript method callable by name that updates a div

[jQuery] Re: Creating callable methods, and binding them to objects' actions.

2009-02-18 Thread mkmanning
of whether I'm looking for its value or to bind to one of its methods.  Can someone shed some light on why I must call each of these methods on the input in the different manners? Thanks. On Feb 18, 7:10 pm, mkmanning michaell...@gmail.com wrote: try: $(input:[...@id:chargetotal]).change

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

2009-02-17 Thread mkmanning
Here's a wholly different approach for consideration. Rather than try and keep track of LI elements and regex their names with the current index, just use an array placeholder and rebuild the list. Chances are if the user is required to add items, the list isn't going to get unmanageably huge (at

[jQuery] Re: Prepended row, slide-in, showing only first cell

2009-02-13 Thread mkmanning
question, if I instead wanted to use multiple table cells instead of one big colspan, is there a way to do this same sort of thing without a div? On Feb 12, 11:35 pm, mkmanning michaell...@gmail.com wrote: That should read ..first-child of its parent,.. in the first sentence On Feb 12, 11:33

[jQuery] Re: Finding the last sibling.

2009-02-12 Thread mkmanning
:last-child) would be it. cheers, - ricardo On Feb 12, 4:19 am, mkmanning michaell...@gmail.com wrote: Somehow the selector disappeared :P $('input').nextAll(':last'); $(this).nextAll(':last'); On Feb 11, 10:17 pm, mkmanning michaell...@gmail.com wrote: $(div :last-child);  finds

[jQuery] Re: uncheck specific checkbox

2009-02-12 Thread mkmanning
In HTML checked is a boolean (of sorts), its presence is sufficient, you don't need to set it to anything; if you want something unchecked you should remove the 'checked' attribute. In XHTML, attribute minimization is forbidden (i.e. attributes can't be empty), so the proper syntax is

[jQuery] Re: uncheck specific checkbox

2009-02-12 Thread mkmanning
thanks for that, I didn't know and it seems to work perfectly But why is it then when I do something like an alert($(mycheckbox).attr ('checked')); on an unckecked checkbox it returns false? On Feb 12, 5:46 pm, mkmanning michaell...@gmail.com wrote: In HTML checked is a boolean (of sorts

[jQuery] Re: Getting data from the corresponding column. (HTML Table with thead and tbody section.)

2009-02-12 Thread mkmanning
Hmm, the group went offline seconds after I posted; I swear it wasn't my fault :P, so sorry if this appears twice; Try this: $(document).ready(function() { $(tbody td).click(function(e) { var index = $(this).parent().children().index(this); alert(

[jQuery] Re: Getting data from the corresponding column. (HTML Table with thead and tbody section.)

2009-02-12 Thread mkmanning
Here's one way: $(document).ready(function() { $(tbody td).click(function(e) { var index = $(this).parent().children().index(this); alert( $(this).parents('tbody').prev().find('tr').children(':eq ('+index+')').text() ); }); $(tbody

[jQuery] Re: Prepended row, slide-in, showing only first cell

2009-02-12 Thread mkmanning
Actually, Mark's use of 'first-child' is correct. ':first-child' is used to indicate the the element is the first-child its parent, not the parent element's first-child. The tr has a class of .ajax, and since it's prepended to the tbody, it is the first-child of the tbody, so the correct selector

[jQuery] Re: Prepended row, slide-in, showing only first cell

2009-02-12 Thread mkmanning
That should read ..first-child of its parent,.. in the first sentence On Feb 12, 11:33 pm, mkmanning michaell...@gmail.com wrote: Actually, Mark's use of 'first-child' is correct. ':first-child' is used to indicate the the element is the first-child its parent, not the parent element's first

[jQuery] Re: trigger click event of anchor endless recursion

2009-02-11 Thread mkmanning
Triggering the click on 'a' fires the click on the the 'td', which triggers the click on 'a', which fires the click on 'td', etc. :) On Feb 11, 9:40 am, johnallan jral...@hotmail.com wrote: jquery 1.3.1 jq(#miniCalendarTable td).hover(         function(){ jq(this).addClass(hover) },        

[jQuery] Re: onclick event on a href calls a function , where to return false to prevent redirection

2009-02-11 Thread mkmanning
Inline JavaScript is generally frowned upon nowadays. A better approach, if you can do it, is to separate your behavior from your markup, the same as you separate your structure from your presentation. It makes for cleaner, more accessible, and more maintainable code. For the example above:

[jQuery] Re: Is A Child Of?

2009-02-11 Thread mkmanning
I just wrote this in response to this thread and haven't checked it thoroughly (other than my head, which has been known to be buggy). I prefer to be able to pass in a jQuery object as the parent: jQuery.fn.childOf = function(a){ return (this.length === this.map(function(){if($.inArray

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

2009-02-11 Thread mkmanning
At the risk of repeating myself from other posts, You might save yourself future problems if you use standards-based id/name attributes (and if the framework you're using doesn't allow that, seriously consider a different framework): HTML 4 spec section 6.2 says, ID and NAME tokens must begin

[jQuery] Re: span and div problem with jquery

2009-02-11 Thread mkmanning
Giving an inline element such as span a display of 'block' makes it...display like a block element. Which means it will stretch to fit its container (in this case the body), as all block elements do. A few more thingsthat might help out: If you want a block element to not do that, you can give

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

2009-02-11 Thread mkmanning
...@gmail.com wrote: Are you talking about using Themes[0] in name? The page was validated by W3C validator ... Do you mean something else? On Feb 11, 10:16 pm, mkmanning michaell...@gmail.com wrote: At the risk of repeating myself from other posts, You might save yourself future

[jQuery] Re: Finding the last sibling.

2009-02-11 Thread mkmanning
$(div :last-child); finds all of the last-child elements, including descendant elements (e.g. if there were an a inside the span in your example it would be returned too). You can also not worry about the parent at all and just use the sibling selector: //or you could use :last-child As

[jQuery] Re: Finding the last sibling.

2009-02-11 Thread mkmanning
Somehow the selector disappeared :P $('input').nextAll(':last'); $(this).nextAll(':last'); On Feb 11, 10:17 pm, mkmanning michaell...@gmail.com wrote: $(div :last-child);  finds all of the last-child elements, including descendant elements (e.g.  if there were an a inside the span in your

[jQuery] Re: selector to return the number of rows in a table before the row I just selected

2009-02-10 Thread mkmanning
rowIndex is a DOM property, so you'd have to use alert(trow [0].rowIndex); On Feb 10, 10:19 am, pantagruel rasmussen.br...@gmail.com wrote:  rowsBefore = row.rowIndex; Ok, but jQuery(#activator + input).parent().parent(); selects the row, but when I try to get rowIndex of that selected row

[jQuery] Re: ID's start with #

2009-02-10 Thread mkmanning
You might save yourself a world of pain if you use standards-based id attributes: HTML 4 spec section 6.2 says, ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (-), underscores (_), colons (:), and periods (.). XHTML

[jQuery] Re: combine slide and fade

2009-02-10 Thread mkmanning
You could try this: jQuery.fn.slideFadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback); }; On Feb 10, 12:31 pm, Paul Mills paul.f.mi...@gmail.com wrote: Hi Chris, It's a bit tricky trying to get 2 effects

[jQuery] Re: $.post NOT_ENOUGH_ARGS

2009-02-10 Thread mkmanning
For the second argument use $(form).serialize() You should also use onsubmit=return CheckForm0(this); although the best practice would be to remove the inline script and bind the submit event like this: $('form').submit(function(){ //do your ajax here and return false }); On Feb 10, 8:14 pm,

[jQuery] Re: Does it hurt to call functions that don't do anything on the page?

2009-02-09 Thread mkmanning
://nicolas.rudas.info/jQuery/getPlugin/may be helpful Otherwise I find Ricardo's suggestion the easiest. You could also do some time tests to check whethercallingthese functions when not really needed effects performance, and act accordingly On Feb 9, 3:33 am, mkmanning michaell...@gmail.com wrote: *Tab

[jQuery] Re: Does it hurt to call functions that don't do anything on the page?

2009-02-09 Thread mkmanning
the title or any other text/element on the page. The choice boils down to how the whole site/app is structured and development practices in use. cheers, - ricardo On Feb 9, 3:29 pm, mkmanning michaell...@gmail.com wrote: @Nicolas - I'm curious as to why you find Ricardo's easiest? Ricardo's

[jQuery] Re: Getting Style Information (left/top)

2009-02-09 Thread mkmanning
Be aware that style.top is not necessarily the position of an element. You can use $('TheDivInQuestion').position().top (and $ ('TheDivInQuestion').position().left) to find it's actual position. On Feb 9, 11:07 am, Michael Lawson mjlaw...@us.ibm.com wrote: If you look at the documentation for

[jQuery] Re: Next/Previous element in each loop

2009-02-09 Thread mkmanning
. cheers, - ricardo On Feb 9, 5:25 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Adrian, as mkmanning already said, when you want to get the next / prev element from the same selector, simply access the array. In this case I prefer a for (var i=0; ips.length; i++) {...} loop

[jQuery] Re: Next/Previous element in each loop

2009-02-09 Thread mkmanning
calls (2 on the first last) Depending upon how many elements you may be operating on, the time difference could become important. On Feb 9, 1:51 pm, mkmanning michaell...@gmail.com wrote: Silently for text(), but it returns null for html()  (using Adrian's second example/my example) so you'll

[jQuery] Re: Numbering ... Could someone please help me out with this?

2009-02-09 Thread mkmanning
You can just check the length of the child li elements of ul#Themes: $('#AddTheme').bind('click', function(){ // Other code var len = $('#Themes li').length; $theme = $('li class=Themes/li').appendTo ('#Themes'); $theme.append('input type=hidden

[jQuery] Re: Does it hurt to call functions that don't do anything on the page?

2009-02-08 Thread mkmanning
You could also just keep the list of functions in an array in your external js file and then check the window object for them: $(function() { var funcs = [ 'ManageCategoriesClick', 'HideByDefault', 'PrepareSplitForm', 'SetUpAdvertPopup', 'CheckAll',

[jQuery] Re: Does it hurt to call functions that don't do anything on the page?

2009-02-08 Thread mkmanning
*Tab+spacebar and it posts :P You could put your list of functions in an array in your external js, then call them on the window object in a loop: $(function() { var funcs = [ 'ManageCategoriesClick', 'HideByDefault', 'PrepareSplitForm',

[jQuery] Re: .hasClass() not behaving as expected.

2009-02-08 Thread mkmanning
In your code you're attaching the hover event to the anchor tags; in the sample html none of the anchors has a class (the class is on the parent li element). On Feb 8, 4:24 pm, MiD-AwE cr.midda...@gmail.com wrote: Please help, I've been wrestling with this for too long now. I've put together

[jQuery] Re: jQuery query string implementation

2009-02-07 Thread mkmanning
FYI I just uploaded a plugin (http://plugins.jquery.com/project/ parseQuery) that's pretty small (449 bytes minified); it parses the querystring into an object. On Feb 5, 6:53 am, jQuery Lover ilovejqu...@gmail.com wrote: Agree, that would be something useful... but it's better to have it as a

<    1   2   3   4