[jQuery] Re: find and replace

2009-04-28 Thread mkmanning
Use a regex: $('body').html( $('body').html().replace(/(got|the)/g,'b$1/b') ); On Apr 28, 9:39 am, kazim mehdi kazim.me...@gmail.com wrote: hi by using the following code  i am able to find only first occurrences of the keywords can anyone help me to make it work for all of the occurrences.

[jQuery] Re: Removing item from array based on property

2009-04-27 Thread mkmanning
Not sure why $.grep didn't work for you. Here's a functioning sample to compare: arr = $.grep(arr,function(n,i){ return n.a1 != 1; }) On Apr 27, 7:51 am, Mervyn mervyn.mar...@gmail.com wrote: Hello all, I have a question about removing an item from an array. I am looking to remove

[jQuery] Re: Is it possible to select on multiple attribute values?

2009-04-25 Thread mkmanning
 pm, mkmanning michaell...@gmail.com wrote: You can always create your own selector: jQuery.extend(jQuery.expr[':'], {     'values': function(a,i,m) {                 return a.value $.inArray(a.value,m[3].split(','))!=-1;     } }); Use like: $('input[name=fooA]:values

[jQuery] Re: creating an animated PNG loader pinwheel (sprite)

2009-04-24 Thread mkmanning
Here's quick plugin for you: http://actingthemaggot.com/test/jquery_example/animbg.html On Apr 24, 7:47 am, Adam adambu...@gmail.com wrote: Thanks everyone, but none of these use jquery- the mootools version is exactly what I am looking to do. Anyone interested in helping me port that to

[jQuery] Re: Help : sort name in an ul where the li's a created from drag and drop.

2009-04-24 Thread mkmanning
Something like this? var sorted = $.makeArray($('ul li')).sort(function(a,b){ return $(a).text() $(b).text(); }); $('ul').html(sorted); On Apr 24, 9:16 am, hollow engstrom.rag...@gmail.com wrote: Hi as the title says i'm looking to order a list taht is created by drag and drop.

[jQuery] Re: Help : sort name in an ul where the li's a created from drag and drop.

2009-04-24 Thread mkmanning
engstrom.rag...@gmail.com wrote: mkmanning Thanks for the response. Yes, but this doesn't give me the result i've changed it to work on click but the result doesn't appear all li's disappears. $('#mylist ul').click(function(){         var sorted = $.makeArray($('#mylist ul li')).sort(function

[jQuery] Re: Is it possible to select on multiple attribute values?

2009-04-24 Thread mkmanning
You can always create your own selector: jQuery.extend(jQuery.expr[':'], { 'values': function(a,i,m) { return a.value $.inArray(a.value,m[3].split(','))!=-1; } }); Use like: $('input[name=fooA]:values(foo1,foo4)'); On this markup it returns the first and last inputs:

[jQuery] Re: traversing UL: Request for help

2009-04-23 Thread mkmanning
From the sample markup with the highlight classes, it looks like the OP wants to highlight anchors in the LI tags that are in direct line to the final anchor. In that case, just adding the class to all the anchors in each parent UL won't work. If you filter the results you can achieve what your

[jQuery] Re: Removing anonymous element

2009-04-22 Thread mkmanning
element.remove() will remove the element from the DOM, but it won't remove it from the jQuery object (in case you want to do any further work with it). On Apr 22, 5:10 am, dth dennis.thry...@gmail.com wrote: But it does :) I have div   a/   b/ /div I have a jquery reference to b that

[jQuery] Re: form.action equivalent in jQuery

2009-04-22 Thread mkmanning
$('input[type=submit]').click(function(){ $('#clientListForm').attr('action',this.id.substring(7)+'.php'); }); Assumes you're submits have ids with a submit_ prefix followed by the name of the page. On Apr 22, 9:13 am, Thierry lamthie...@gmail.com wrote: I currently have the following legacy

[jQuery] Re: Infinite Recall Over a Fixed Interval

2009-04-22 Thread mkmanning
With arguments.callee wouldn't you still lose the original 'this' ? Why not a closure, just set 'this' to 'that'. Also, you should return the jQuery object: (function($) { $.fn.JSClock2 = function() { var that = this; setInterval(function() {

[jQuery] Re: Get all radiobutton in a span

2009-04-22 Thread mkmanning
If you want valid HTML, you can't put a span around a table (or any block level element). On Apr 22, 9:14 pm, Nitin Gautam gautam.ni...@gmail.com wrote: Thanks for both replies..it works now =) On Apr 22, 10:55 pm, Ignacio Cortorreal luis3igna...@gmail.com wrote: #list_0 input:radio  

[jQuery] Re: Infinite Recall Over a Fixed Interval

2009-04-22 Thread mkmanning
Here's my (working) example online for you to look at: http://actingthemaggot.com/test/jquery_example/clock.html HTH :) On Apr 22, 10:00 pm, kiusau kiu...@mac.com wrote: On Apr 22, 9:18 pm, Ricardo ricardob...@gmail.com wrote: Just add setTimeout(arguments.callee, 1000); to the end of the

[jQuery] Re: Sort losing click association

2009-04-21 Thread mkmanning
Your example code works fine for me. Your event is hard-coded (not the best approach btw), and you're not overwriting the inputs (so you wouldn't need .live() or the livequery plugin. Can you be more specific about what you see happening? On Apr 21, 7:21 am, Blaine bla...@worldweb.com wrote:

[jQuery] Re: delaying an action

2009-04-21 Thread mkmanning
From a user-interaction standpoint, you might want to rethink the amount of time you delay. Obviously I don't know your specific situation, so maybe there's a very strong indicator to the user to wait for the effect. If there isn't, just beware that while you know what's supposed to happen when

[jQuery] Re: help with persistant:location variable...

2009-04-21 Thread mkmanning
You forgot this one ;) http://plugins.jquery.com/project/parseQuery (449 bytes, handles multiple name-value pairs with the same name) On Apr 21, 10:55 am, Ricardo ricardob...@gmail.com wrote: Simplest way is to use a regular expression: var location = /[?]location=(\w+)?/.exec(

[jQuery] Re: Sort losing click association

2009-04-21 Thread mkmanning
. 7) NO alert appears... It should On Apr 21, 10:11 am, mkmanning michaell...@gmail.com wrote: Your example code works fine for me. Your event is hard-coded (not the best approach btw), and you're not overwriting the inputs (so you wouldn't need .live() or the livequery plugin. Can you

[jQuery] Re: Sort losing click association

2009-04-21 Thread mkmanning
 pm, Blaine bla...@worldweb.com wrote: That's a great idea, however this is just a snipplet of what I'm actually doing to outline the issue. In the real application each click function does something custom. On Apr 21, 2:58 pm, mkmanning michaell...@gmail.com wrote: Ah, I see; I thought you

[jQuery] Re: Appending Element to iFrame body blowing up in IE

2009-04-21 Thread mkmanning
Your iframe has no src attribute (so there's no document there). On Apr 21, 1:32 pm, stony_dreams amitsau...@gmail.com wrote: I see the same problem. If i read the exception that gets thrown, its simply: Error. Nothing informative. I just create an iframe dynamically and have an image tag as

[jQuery] Re: Assigning a List of Key-Value Pairs to a DIV Tag

2009-04-21 Thread mkmanning
.html() overwrites the innerhtml for that element. Try .append(). On Apr 21, 10:08 pm, kiusau kiu...@mac.com wrote: QUESTION:  Is it possible to use the for-in statement to list all of the key:value pairs of an object in a div tag? BACKGROUND:  The following code (see SOURCE CODE below)

[jQuery] Re: Making inserted links active

2009-04-20 Thread mkmanning
Check out .live() in the docs http://docs.jquery.com/Events/live#typefn On Apr 20, 7:55 am, Roddie jqu...@myword.co.uk wrote: On a form, I have an Insert new field below here link. Clicking it inserts a new field, and also inserts another Insert new field below here link. This is so the user

[jQuery] Re: load json

2009-04-20 Thread mkmanning
For your JSON you'd need obj.libelle, obj.countryId, obj.code, etc. You also don't really need the if statement checking the length. On Apr 20, 6:34 am, chakrounb...@gmail.com wrote: Hi everybody My  json   return  these values [{libelle:France,countryId:1,code:FR},

[jQuery] Re: show element if class matches current bod y id (Please help) « View previous topic :: View next topi c » Author

2009-04-19 Thread mkmanning
I posted on the duplicate of this, so I'll try here to :) Is there any particular reason you need JavaScript to do this, instead of just using CSS? #menu ul { display:none; } body#foo ul.foo, body#bar ul.bar, body#foobar ul.foobar { display:block; } Waiting until domready to

[jQuery] Re: Append before closing tag

2009-04-19 Thread mkmanning
Um, I have no idea what all that is for, but append already does exactly what you're asking: it appends html as the last child of the parent. $('p').append('a href=http://www.hotbot.com;Remember Me?/a'); On Apr 19, 12:38 am, Josh Powell seas...@gmail.com wrote: Below is the call and where

[jQuery] Re: Append before closing tag

2009-04-19 Thread mkmanning
Sorry, it's late. I see now you're showing where each method inserts content :P On Apr 19, 12:38 am, Josh Powell seas...@gmail.com wrote: 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

[jQuery] Re: Selecting menu items by value

2009-04-19 Thread mkmanning
$('select[value=yes]') should return all of the select menus with 'yes' as the chosen option. On Apr 19, 2:42 am, ajc acuc...@gmail.com wrote: I am trying to figure out how to select all the menu items that have a particular value in a form. For example, let's say you had a form with 10

[jQuery] Re: Selecting menu items by value

2009-04-19 Thread mkmanning
]').size()); This shows 0, when there is one menu with ext as the value. If I remove the value expression and just use 'select', I get 9 as the output, which is correct as there are nine menus on the page. Any ideas? Thanks, Anthony On Apr 19, 10:40 am, mkmanning michaell...@gmail.com wrote

[jQuery] Re: add href to table row from link inside row

2009-04-19 Thread mkmanning
Just to clarify, your row can't have an href as that's not a valid attribute, but you can put a click handler on the row and have it access the contained anchor to get the href. This might get you started: $('tr.row').click(function(){ var href = $(this).find('a').attr('href'); }) Be aware

[jQuery] Re: fadeOut Callback Trigger Count

2009-04-19 Thread mkmanning
You could keep a running count of how many li's have called fadeOut and store it with .data(). Here's an example storing it on the parent ul: $(#menu ul li a).click(function(e) { e.preventDefault(); var li = $(this).parent().siblings(); li.fadeOut(function() {

[jQuery] Re: show if class matches current body id

2009-04-18 Thread mkmanning
Is there any particular reason you need JavaScript to do this, instead of just using CSS? #menu ul { display:none; } body#foo ul.foo, body#bar ul.bar, body#foobar ul.foobar { display:block; } On Apr 18, 10:05 am, Max mackerma...@gmail.com wrote: Thanks so much for the reply.

[jQuery] Re: question about dealing with JSON callback

2009-04-17 Thread mkmanning
format or it may not. If you want to quibble about whether the resolved object should then be called JSON that's fine, but also totally beside the point. On Apr 17, 12:56 am, dhtml dhtmlkitc...@gmail.com wrote: On Apr 16, 5:14 pm, mkmanning michaell...@gmail.com wrote: As I said before: it's

[jQuery] Re: I need some hints

2009-04-17 Thread mkmanning
András, you can use CSS as MorningZ said: tr:hover td {/*some color*/} If you're td's don't have a background color, you can put it directly on the tr tr:hover {/*some color*/} Note that IE6 doesn't support the :hover pseudo-class on elements other than anchors, to if IE6 support is needed,

[jQuery] Re: I need some hints

2009-04-17 Thread mkmanning
The second function in my example went missing :P $('tr').hover(function(){ $(this).addClass(CLASS_WITH_BACKGROUND_COLOR); }, function(){ $(this).removeClass(CLASS_WITH_BACKGROUND_COLOR); }); On Apr 17, 4:04 pm, mkmanning michaell...@gmail.com wrote: András, you can use CSS as MorningZ

[jQuery] Re: question about dealing with JSON callback

2009-04-16 Thread mkmanning
Just an FYI, but there's no 'object side' of the json in your example. It just an object, consisting of name-value pairs. While you can leave quotes off of the names, they are strings which, according to the RFC, should be quoted. Doing so will not cause problems, and will save you from

[jQuery] Re: how can I delete all elements: children and parent

2009-04-16 Thread mkmanning
But won't work if the parent element contains other elements. Why not just use .remove() on the span? Btw, an ID that is a number (or starts with a number) is invalid. On Apr 16, 6:21 am, Raja Koduru kscr...@gmail.com wrote: $(#57).parent().empty() could work. check

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread mkmanning
$('#no-defs')[$('.def').length==0?'show':'hide'](); On Apr 16, 1:54 pm, MorningZ morni...@gmail.com wrote: There isn't much you can do with that since you can't conditionally code in .show or .hide unless you made a plugin to pass in a true/ false parameter and decide in the plugin, for

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread mkmanning
show() and hide() are methods of the jQuery object, so they're accessible with both dot and bracket notation as with any method or attribute of an object. On Apr 16, 2:12 pm, Joseph Le Brech jlebr...@hotmail.com wrote: I'm impressed by the [] brackets, does that eval() the 'hide' and 'show'

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread mkmanning
Guess it depends on who the next guy is :) On Apr 16, 2:16 pm, Andy Matthews li...@commadelimited.com wrote: I'd be careful with code like that. It is terse, and very elegant, but not all that readable from a coding for the next guy mentality.   _   From: jquery-en@googlegroups.com

[jQuery] Re: Where am I going wrong?

2009-04-16 Thread mkmanning
What James said. This is one of those edge-cases that can ruin your day. If you look up the list of JavaScript reserved words, more than likely you won't see 'closed' on it, because it's not really a reserved word. It is however a property of the window object, and so only has a getter, not a

[jQuery] Re: question about dealing with JSON callback

2009-04-16 Thread mkmanning
as 'json' (or text and eval'd yourself if you like), that's an object. It's composed of name:value pairs. The names are strings. If you don't like what the RFC says, take it up with Douglas Crockford. On Apr 16, 2:25 pm, dhtml dhtmlkitc...@gmail.com wrote: On Apr 16, 12:42 am, mkmanning michaell

[jQuery] Re: how to streamline my code with Event Delegation?

2009-04-16 Thread mkmanning
You could put event delegation on the containing element, and then use the target's index within its parent. From Andy's example this would be: div id=linkContainer a href=link 01/a a href=link 02/a /div $('linkContainer').click(function(e){ var targ = $(e.target), index =

[jQuery] Re: question about dealing with JSON callback

2009-04-16 Thread mkmanning
. I'm just addressing the specific question of whether JSON is an actual object or a string that represents an object. -Mike From: mkmanning So you're saying JSON is not an object, it's a string? What does the O stand for then? The OP gave this example JSON: {         product_id

[jQuery] Re: question about dealing with JSON callback

2009-04-16 Thread mkmanning
} On Apr 16, 5:14 pm, mkmanning michaell...@gmail.com wrote: As I said before: it's a string until it's eval'd, which happens with the 'json' response type within jQuery, or as I said you can eval the response text yourself. At that point it is JavaScript, and it's an object whose members you

[jQuery] Re: Check value when adding to array

2009-04-15 Thread mkmanning
...@gmail.com wrote: Could you explain this one a little more?  How you coded it is a little confusing to me. On Apr 13, 6:34 pm, mkmanning michaell...@gmail.com wrote: If I understand you code, you're trying to create an array of name=value, with value being specifically set if the name has

[jQuery] Re: Creating custom attributes in html

2009-04-15 Thread mkmanning
This is not quite to the point of discussing the merits per se, but still germane I think. RobG pointed out that you're using the name attribute in a div, which isn't valid. It's also not valid in a td, but obviously that only matters if validation is important to you (which is a totally separate

[jQuery] Re: passing elem id to a JS function...

2009-04-15 Thread mkmanning
var img_top = $(#+curr_img); On Apr 15, 8:57 am, kali maya778...@yahoo.com wrote: hi, am trying to do image-hide/img-show with jQuery (now use 'regular' JavaScript DOM-scripting..  want to switch to jQuery..  but am having some difficulties: I have this function-call in interface:  

[jQuery] Re: Plugin does not bind to jQuery object

2009-04-15 Thread mkmanning
You also have a reference to jQuery 1.2.6 as well as 1.3.2; near the bottom of the page: script type=text/javascript src=/lib/javascript/jquery-1.2.6.js/ script On Apr 15, 1:44 pm, Thomas Allen thomasmal...@gmail.com wrote: No, that's not it. The scripts are ordered: script

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

2009-04-14 Thread mkmanning
Your calling toDate() as a method on the jQuery object, which it isn't; it's simply a function that prints out the date (and you should maybe rethink the document.write, it's deprecated). If you want the output to appear as the content of the element with id 'today' then do something like

[jQuery] Re: Trouble passing additional data with getJSON

2009-04-13 Thread mkmanning
My guess would be you're not returning false anywhere on the form submit, so the form is submitting. On Apr 13, 2:14 pm, Kathryn kathry...@gmail.com wrote: Hi all, I think I must be making an obvious mistake, but I can't see it. I'm trying to pass additional data to the server with getJSON,

[jQuery] Re: Check value when adding to array

2009-04-13 Thread mkmanning
If I understand you code, you're trying to create an array of name=value, with value being specifically set if the name has _test in it? var arr = $.map($('input'),function(n,i){ return n.name+'='+(n.name.indexOf('_test')!=-1?'some_value':n.value); }); On Apr 13, 5:27 pm, Nic Hubbard

[jQuery] Re: Adding incremental numbered classes to divs

2009-04-09 Thread mkmanning
Since you're not using the class for styling, but indexing, why not just use the natural index of the div in its container, or from the jQuery object itself? $('.ngg-gallery-thumbnail-box') is an array-like object, so you can iterate over it, or access its members by index number, such as $

[jQuery] Re: .split an elements attribute

2009-04-09 Thread mkmanning
Try alert( typeof(link_path) ) and you'll see it's a function. Try link_path.toString() and then split it. On Apr 9, 2:54 pm, Nic Hubbard nnhubb...@gmail.com wrote: I am getting the attribute of an image on a page.  It is the onclick attribute, but I need some text from the onclick function.

[jQuery] Re: get reference to nested appended element

2009-04-07 Thread mkmanning
Caveat: Jonathan's method will get you the child table (the one with id rt0 from the original OP's example), however Eric's will get you all tables that are children of a table, within the context of the parent container. So in the latter case, if the parent already had a set of nested tables

[jQuery] Re: a better selection method

2009-04-02 Thread mkmanning
Actually there's an easier way as long as the links and the items being hidden/show have a one-to-one relationship. $(document).ready(function(){ var a = $('ul.selector li a'), div = $('div.youtube').children ('div'); a.click(function(){ $(div.hide().get(a.index(this))).show();

[jQuery] Re: inserting commas into a price value

2009-04-02 Thread mkmanning
http://plugins.jquery.com/project/currencyFormat On Apr 2, 9:58 am, Adam adambu...@gmail.com wrote: I am trying to manipulate a simple value (text node) which is a home price from 123456789 to be 123,456,789. Anyone have a resource? Thanks! -Adam

[jQuery] Re: inserting commas into a price value

2009-04-02 Thread mkmanning
. 99 becomes (999) 999-).  Any chance of whipping that up? :) I did look at the plugin you just posted, thinking I could tweak it to fit my needs.  But it's a bit over my head :\ On Thu, Apr 2, 2009 at 11:04 AM, mkmanning michaell...@gmail.com wrote: http://plugins.jquery.com

[jQuery] Re: Getting all children, not just immediate children??

2009-04-01 Thread mkmanning
siblings() returns..siblings. Brothers/sisters, which aren't descendants. To get immediate children (sons/daughters), use children() To get descendants (sons/daughters, grandchildren, great- grandchildren, etc.) then use find() btw, do you mean to have a space here: .slideToggl e(); ? On Apr 1,

[jQuery] Re: Getting all children, not just immediate children??

2009-04-01 Thread mkmanning
? Thanks -Brian On Wed, Apr 1, 2009 at 8:48 PM, mkmanning michaell...@gmail.com wrote: siblings() returns..siblings. Brothers/sisters, which aren't descendants. To get immediate children (sons/daughters), use children() To get descendants (sons/daughters, grandchildren, great

[jQuery] Re: distinguishing between clicks on an outer container vs an inner link

2009-03-31 Thread mkmanning
Get rid of the anchor (it's not valid anyway), and you don't need to bind two click functions; your event delegation is fine--almost: You need to wrap the event with $() to use the attr() method. $(#row33).click( function(e) { if( $(e.target).attr(id) == innerX) { ; // do inner link

[jQuery] Re: Get element's html and the element

2009-03-30 Thread mkmanning
Resort to wrappers :). They don't actually have to be in the DOM: var outerhtml = $('div').append($('#container').clone()).html(); outerhtml -- div id=containerall the content/div On Mar 30, 12:40 am, Steven Yang kenshin...@gmail.com wrote: well html() just gets the innerHTMLso your out of

[jQuery] Re: next / siblings issue

2009-03-29 Thread mkmanning
Adding the expr just filters the matched elements further. Try .nextAll ('select'). On Mar 29, 2:42 am, Dunc duncan.we...@gmail.com wrote: I'm building cascading selects, but because they could come from mulitple locations within the HTML, I need to capture the ID of the parent select (easy

[jQuery] Re: next / siblings issue

2009-03-29 Thread mkmanning
to filter 'em out. Any other hints? On 29 Mar, 15:28, mkmanning michaell...@gmail.com wrote: Adding the expr just filters the matched elements further. Try .nextAll ('select'). On Mar 29, 2:42 am, Dunc duncan.we...@gmail.com wrote: I'm building cascading selects, but because

[jQuery] Re: return position in an array

2009-03-29 Thread mkmanning
$(selector_for_your_element).is(:last-child) will return a boolean, which it sounds like you'd want for your conditional anyway? On Mar 29, 2:14 pm, Victor Nogueira victor.carcr...@gmail.com wrote: In other words, I need to check the position of the element who has the .example class. (It's

[jQuery] Re: bind to front of event stack

2009-03-27 Thread mkmanning
Eric, Nice work! I just did a quick test and it appears that once the override event is inserted into the stack, it bumps the event it's replacing to the end. That is, if I insert it at position 0, and then unbind it, the event firing order is now 2,3,4,1. Same if I insert it into position one,

[jQuery] Re: Inserting rows of DIVs to create a list

2009-03-26 Thread mkmanning
a dynamic list implies something more semantic than a row of divs, say a UL or DL...but if you want divs, here's a quick example: div id=template style=display:none;!-- everything inside this div will be cloned -- divinput type=text id=tmp_input /button/button/div /div

[jQuery] Re: Executing javascript that comes inside an AJAX response

2009-03-26 Thread mkmanning
. On Mar 24, 8:07 pm, mkmanning michaell...@gmail.com wrote: If you're going to use jQuery, you have to be careful about writing code that then doesn't use jQuery. In this case, you're ajax call would have worked fine, if you had stuck with injecting the response into the DOM with jQuery

[jQuery] Re: looping through json

2009-03-26 Thread mkmanning
You can't put 'bare' key/value pairs in an array, and reusing a key like department isn't really good either. A simpler structure would just be: [ {ID: 1, Name: Physics}, {ID: 2, Name: Chemistry}, {ID: 3, Name: Biology} ] Unless you have some compelling reason to assign the array to the

[jQuery] Re: looping through json

2009-03-26 Thread mkmanning
This: var departments = new Array(); var department = {}; department.ID = 1; department.Name = Physics; deparments.push(department); is not a non-shorthand version of this: { departments: [ department: {ID: 1, Name: Physics}, department: {ID: 2, Name: Chemistry}, department: {ID: 3,

[jQuery] Re: looping through json

2009-03-26 Thread mkmanning
Sorry, that should have read can't: which is basically my example. You CAN'T have elements in an array like this: [ department: {ID: 1, Name: Physics} ] On Mar 26, 8:59 pm, mkmanning michaell...@gmail.com wrote: This: var departments = new Array(); var department = {}; department.ID = 1

[jQuery] Re: looping through json and adding dom elements (options)

2009-03-25 Thread mkmanning
I've not tried Eric's plugin, but if converting the JSON is an issue, you can use what you have (but be sure and quote the string values; preferably the keys too even though most people don't): [ {Value: 1, Item: 'Physics'}, {Value: 2, Item: 'Chemistry'}, {Value: 3, Item: 'Biology'} ]; Here's

[jQuery] Re: looping through json and adding dom elements (options)

2009-03-25 Thread mkmanning
remove all options from a drop down and populate it with new items from the json if possible, it will be good if i can have a default null option eg Please select an option that does not do anything if the user selects it or shows at the start and disappears once user selects it? ??? If you

[jQuery] Re: Alert on click of class alerts n amount of times (n = amount of same class in doc).

2009-03-24 Thread mkmanning
Can you give a little more detail on the markup? Is there a chance those elements are nested inside each other? On Mar 24, 6:16 am, MorningZ morni...@gmail.com wrote: You're probably rebinding that event multiple times try jQuery('.wp_sl', my_frame).unbind().click( function() { alert (hi)

[jQuery] Re: Executing javascript that comes inside an AJAX response

2009-03-24 Thread mkmanning
If you're going to use jQuery, you have to be careful about writing code that then doesn't use jQuery. In this case, you're ajax call would have worked fine, if you had stuck with injecting the response into the DOM with jQuery, as it automatically evals scripts in a response with dataType of

[jQuery] Re: jQuery right before /body tag?

2009-03-23 Thread mkmanning
It works fine, and it's a good idea. Check out Steve Souder's performance rules developed while he was at Yahoo!: http://developer.yahoo.com/performance/rules.html#js_bottom On Mar 23, 2:12 pm, Nic Hubbard nnhubb...@gmail.com wrote: I am working on optimizing my page for speed.  And, in doing

[jQuery] Re: Suggestion on solution for array to new html content

2009-03-23 Thread mkmanning
Why not do two passes, since the array will have a one-to-one correspondence with the divs in the containing div? $(document).ready(function(){ var arr = [{content: 'some html 1', data: 'some data 1'},{content: 'some html 2', data: 'some data 2'},{content: 'some html N', data: 'some data

[jQuery] Re: Keeping jquery codes up to date - best practise?

2009-03-22 Thread mkmanning
You can link to the latest major number, for example http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js gets you 1.3.2; it will automatically update to the next 1.#.# version when available. http://ajax.googleapis.com/ajax/libs/jquery/1.2/jquery.min.js Gets you 1.2.6 (the latest

[jQuery] Re: Rotating CSS classes each 5 sec

2009-03-22 Thread mkmanning
('rotate-class') }, 5000); }); On Mar 21, 2:03 pm, mkmanning michaell...@gmail.com wrote: NaN is happening because of an error in this line: parseInt(div.className.substring(3)); It most likely means your className is different. I just tested the code in Firefox

[jQuery] Re: Rotating CSS classes each 5 sec

2009-03-22 Thread mkmanning
. Crowder t...@crowdersoftware.com wrote: @mkmanning: I was intentionally creating something instructive, not dense.  What I gave him is longer than your approach, but not so dramatically as you seem to suggest -- most of the difference is that mine is commented, doesn't compound unrelated

[jQuery] Re: Rotating CSS classes each 5 sec

2009-03-22 Thread mkmanning
Presumably, which points out a recurring problem: because we don't know the OP's intended use, vis-à-vis actual markup and CSS, etc. everything we suggest is somewhat academic. There's a tradeoff with modifying style rules vs. using class names. If you find yourself having to alter too many

[jQuery] Re: Rotating CSS classes each 5 sec

2009-03-21 Thread mkmanning
at 4:13 AM, mkmanning michaell...@gmail.com wrote: Another alternative (no array needed, goes from img1 to img5 and starts over): $(document).ready(function(){        div = $('div.img1')[0], //get with whatever selector once        swapDiv = setInterval(function(){                n

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

2009-03-20 Thread mkmanning
You can hide the links from users with JavaScript enabled by placing this in the head of your page: script type=text/javascript document.documentElement.className = js; /script Then hide the links (by a, or #, or class) in your CSS: style type=text/css .js a {display: none;} /style Then

[jQuery] Re: Rotating CSS classes each 5 sec

2009-03-20 Thread mkmanning
Another alternative (no array needed, goes from img1 to img5 and starts over): $(document).ready(function(){ div = $('div.img1')[0], //get with whatever selector once swapDiv = setInterval(function(){ n = parseInt(div.className.substring(3));

[jQuery] Re: access denied error in IE

2009-03-20 Thread mkmanning
You can't access the content of an iframe when it's in a different domain (different domain == subdomain). On Mar 20, 7:58 pm, Dhana sldh...@gmail.com wrote: I know this message is not supposed to be here since it's not a jquery issue, but I really need some in depth help on this. I have an

[jQuery] Re: access denied error in IE

2009-03-20 Thread mkmanning
trying to share data across those two iframes.  Would that still be affected? On Mar 20, 8:28 pm, mkmanning michaell...@gmail.com wrote: You can't access the content of an iframe when it's in a different domain (different domain == subdomain). On Mar 20, 7:58 pm, Dhana sldh...@gmail.com

[jQuery] Re: access denied error in IE

2009-03-20 Thread mkmanning
Although not all the time :P I just tried your page again and didn't get the error. Failed once in Chrome due to the error, worked after that in Chrome, FF3, IE7. On Mar 20, 8:40 pm, mkmanning michaell...@gmail.com wrote: Ah, not a cross domain issue. It's an SSL error: it appears that your

[jQuery] Re: access denied error in IE

2009-03-20 Thread mkmanning
itself as?  Any firefox tool ? On Mar 20, 8:47 pm, mkmanning michaell...@gmail.com wrote: Although not all the time :P I just tried your page again and didn't get the error. Failed once in Chrome due to the error, worked after that in Chrome, FF3, IE7. On Mar 20, 8:40 pm, mkmanning michaell

[jQuery] Re: compare jQuery objects

2009-03-19 Thread mkmanning
Two objects are equal if they refer to the exact same Object. On Mar 19, 1:48 pm, bob xoxeo...@gmail.com wrote: How is it that I get false for the following? Shouldn't I get true as a result? if not, why? div id=home/div $(document).ready(function(){         var one = $('#home');      

[jQuery] Re: jQuery checkbox checked attribute only enters in IE

2009-03-19 Thread mkmanning
I have a plugin here that makes it easy to copy the attributes: http://plugins.jquery.com/project/getAttributes I just tested it on a checkbox in FF2/3 and Chrome, and I create a checkbox with the copied attributes and append to the DOM, and the checkbox is checked (you also get the checkbox if

[jQuery] Re: scrollTo firefox ugliness

2009-03-19 Thread mkmanning
Try changing overflow:auto to overflow:hidden in scroll.css*: .section{ width:3900px; position:relative; overflow:auto; } *n.b.: I only did this in Firebug, so not promising anything :) On Mar 19, 4:36 pm, Dan Pouliot danpoul...@gmail.com wrote: First let me say a

[jQuery] Re: where to load init function with google?

2009-03-18 Thread mkmanning
code should go at the end of the html doc, right before closing /body tag? I thought it should go in the header. Sorry for the ignorance, -- Milan On Mar 17, 8:22 pm, mkmanning michaell...@gmail.com wrote: You don't need the callback, but you can call

[jQuery] Re: Look for UL

2009-03-17 Thread mkmanning
if ($(this).find(ul)) { ... will always return a jQuery object and so evaluate to true; you need to check the length: if ($(this).find(ul).length0) { ... On Mar 17, 8:57 am, so.phis.ti.kat see.marlon@gmail.com wrote: Hello Everyone, I tried doing a search and found some possible

[jQuery] Re: where to load init function with google?

2009-03-17 Thread mkmanning
You don't need the callback, but you can call it with: google.setOnLoadCallback(init); The domready wrapper is still a good idea though, depending upon where your scripts are--at the close of the body we hope :) On Mar 17, 2:52 pm, Milan Andric mand...@gmail.com wrote: Hello, I was just

[jQuery] Re: Toggle stealing my sanity....

2009-03-16 Thread mkmanning
this won't work: jQuery(#profile-edit-avatar).toggle(alert('toggled!')); do this: jQuery(#profile-edit-avatar).toggle(function(){alert ('toggled!');}); On Mar 16, 7:51 am, Michal Popielnicki michal.popielni...@gmail.com wrote: Hi there. I'm running jquery 1.3.2 and I've found rather strange

[jQuery] Re: Annoying IE Flash

2009-03-16 Thread mkmanning
I usually put on small bit of js in the head: script type=text/javascript document.documentElement.className = js; /script Then hide elements you like in your CSS: style type=text/css .js element_to_hide {display: none;} /style That way elements are only hidden if the user has JavaScript

[jQuery] Re: help with menu and show/hide divs

2009-03-15 Thread mkmanning
As long as you have a one-to-one relationship between your links and your divs, you don't need to worry about IDs or hrefs, etc. Just use the index position: div id=links a href=#first/a a href=#second/a a href=#third/a /div div id=container divtest1/div

[jQuery] Re: Simple toggle between slide up slide down and changing paragraph html contents not working...

2009-03-15 Thread mkmanning
You don't need .each(), and if you want reduce your code you can, with chaining, do it all in a one line of jQuery: CSS (to initially hide all the contents): p.contents{ display:none; } HTML ('contents' class added for easier selecting): ul li pItem 1/p p

[jQuery] Re: why coding like this:(function(){})();

2009-03-15 Thread mkmanning
Not sure what you mean inline or by scope the vars inside; variables declared inside the function are scoped inside (they have lexical scope to the function), as long as they are preceded with the var declaration (if not, they are global, even with this format). The closing/end parens creates a

[jQuery] Re: TextArea CountDown

2009-03-15 Thread mkmanning
No, but it's pretty easy to write one :) textarea/textarea div id=counter/div $('textarea').keyup(function(){ if(this.value.length = 100) { //handle the over the limit part here $(this).addClass('overlimit'); this.value = this.value.substring(0, 100);

[jQuery] Re: Working with hash?

2009-03-15 Thread mkmanning
If you mean the querystring as in: mysite.com?name=jonasphone=12345 //note the ? instead of # Then you can use this plugin (it will parse the querystring into a hash like you want): http://plugins.jquery.com/project/parseQuery On Mar 15, 8:30 am, brian bally.z...@gmail.com wrote: On Sun, Mar

[jQuery] Re: Working with hash?

2009-03-15 Thread mkmanning
a querystring on the location hash, you'll most likely have to make your own parser (since it's unlikely anybody else would do it this way). On Mar 15, 10:52 am, brian bally.z...@gmail.com wrote: On Sun, Mar 15, 2009 at 1:43 PM, T.J. Crowder t...@crowdersoftware.com wrote: @brian, @mkmanning:  FWIW

<    1   2   3   4   >