[jQuery] Re: How to Get Div from IFrame

2009-11-20 Thread mkmanning
No. Cross domain also applies to different sub-domains, protocols, and ports. On Nov 20, 11:17 am, webspee...@gmail.com webspee...@gmail.com wrote: Outside of my domain, I can understand. I'll have to hold off for a bit then. Although the page will be remote, it will be accessible

[jQuery] Re: :gt and :lt don't accept variable as a parameter?

2009-11-17 Thread mkmanning
Try $('#filterlist_wrapper ul li:gt('+left_col+')') On Nov 17, 3:35 pm, Magnificent imightbewrongbutidontthin...@gmail.com wrote: It should read: I'm storing my counts in variables, but it doesn't look like :gt and :lt can accept a VARIABLE value as it's parameter. It works when I put

[jQuery] Re: cannot insert html into DIV

2009-11-04 Thread mkmanning
If you used Andrew's example, then you added a jQuery object to the canvasClasses array. Calling innerHTML on a jQuery object won't work. Try canvasClasses[0].html('htmlhere') On Nov 4, 3:35 pm, shaf shaolinfin...@gmail.com wrote: That doesnt work either. On Nov 4, 11:28 pm, Andrew Tan

[jQuery] Re: Simple question. my query isnt working

2009-10-30 Thread mkmanning
Where are you including the scripts? If they're in the head, then you need to wrap your selector in a document.ready function, as the script is running before your div exists in the DOM. Try including your scripts just before the closing body tag. On Oct 30, 7:44 pm, numerical25

[jQuery] Re: Select the inverse of what you're looking for

2009-10-30 Thread mkmanning
Try this: $(tr:not(:contains(Brown))).css(background-color, Red); On Oct 30, 12:58 pm, Aaron Gusman ict.aarongus...@gmail.com wrote: I have a table with 2 columns and four rows.  I am currently able to highlight the row which contains a specific piece of text.  But what I want to do is to

[jQuery] Re: Simple problem

2009-10-29 Thread mkmanning
var panelID = panel_ + $(input).val(); You're problem is the selector; look at it for a second to see why it won't work (think about what exactly it's selecting). If you want the value of the button that was clicked, just reference it with 'this', as in var panelID = panel_ + this.value; or

[jQuery] Re: Click multiple times, different states, saves different data to DB (confusing?)

2009-10-22 Thread mkmanning
:46 am, mkmanning michaell...@gmail.com wrote: .toggle() allows you to rotate through multiple functions, you might want to check it out in the docs:http://docs.jquery.com/Events/toggle#fnfn2fn3.2Cfn4.2C... On Oct 21, 2:58 am, The Danny Bos danny...@gmail.com wrote: I've got one

[jQuery] Re: Click multiple times, different states, saves different data to DB (confusing?)

2009-10-22 Thread mkmanning
to 'YYY' the third click ... etc Know what I mean? On Oct 22, 6:04 pm, mkmanning michaell...@gmail.com wrote: Well, if you just want to loop through the array to change the background color, you don't really need toggle then. Try this:  $(#item_list li div a).click(function

[jQuery] Re: Click multiple times, different states, saves different data to DB (confusing?)

2009-10-22 Thread mkmanning
'], Thanks again, On Oct 22, 6:27 pm, mkmanning michaell...@gmail.com wrote: Yeah, the snippet I wrote updates the color; you can add an ajax call to update your db as well, if the value your updating in the db is the color, or else the value is in an array that's indexed the same

[jQuery] Re: Click multiple times, different states, saves different data to DB (confusing?)

2009-10-21 Thread mkmanning
.toggle() allows you to rotate through multiple functions, you might want to check it out in the docs: http://docs.jquery.com/Events/toggle#fnfn2fn3.2Cfn4.2C... On Oct 21, 2:58 am, The Danny Bos danny...@gmail.com wrote: I've got one for ya, JQuery and Ajax. I want to have a button image,

[jQuery] Re: Creating a Function based on text argument

2009-10-21 Thread mkmanning
Operations like .val() return a string, so If you need to extend a string you have to use String.prototype: String.prototype.slug = function(){return this.trim().etc...} The way you've done it works, but in the same way 'trim' works, i.e. you have to pass the string to the function:

[jQuery] Re: Get parameters from URL

2009-10-17 Thread mkmanning
There are several plugins: http://plugins.jquery.com/project/parseQuery On Oct 17, 7:41 am, ReynierPM rper...@uci.cu wrote: Hi every: It's possible to get values from URL with jQuery like PHP? For example suppose you have this URL: form.html?s=okval=rperezm. In PHP is simple: [code]  

[jQuery] Re: $('a:link') Selector?

2009-10-17 Thread mkmanning
A couple things. First off, the syntax you're using won't get you the anchor's color: $('a:link',this).css('color'); This is a shortcut for: $(this).find('a:link').css('color') which basically means find the anchors inside this anchor. If you want the anchor's original color, just use:

[jQuery] Re: How to obtain Object (key) names?

2009-10-17 Thread mkmanning
The problem with something like the desired approach: if (option.name == Option1) { is that 'name' is a valid key, so if you had an object like {'name':'john'} option.name would equal 'john' (same problem if you tried option.key). Also, though your example only has one key, an object can

[jQuery] Re: How to Sort an Unordered List - TinySort

2009-10-14 Thread mkmanning
Never used the plugin, but doing the sort you want is fairly simple: $('#refmenu').click(function(){ var sorted = $.makeArray($('#listli')).sort(function(a,b){ return ($(a).children('a').attr('title') $(b).children('a').attr ('title')) ? -1 : 1; }); $('#list').html(sorted); }); HTH

[jQuery] Re: Selecting all last cells in all rows?

2009-10-12 Thread mkmanning
$('td:last-child') On Oct 12, 9:45 am, MorningZ morni...@gmail.com wrote: with this html: table     tbody         tr              td.../tdtd.../tdtd.../td         /tr         tr              td.../tdtd.../tdtd.../td         /tr         tr              td.../tdtd.../tdtd.../td        

[jQuery] Re: possible to empty file input in form with .click or .focus ?

2009-10-12 Thread mkmanning
You could replace the file input when the URL field is focused: $('#fu').replaceWith('input id=fu type=file /'); where #fu is the file input. On Oct 12, 11:53 am, amuhlou amysch...@gmail.com wrote: hmm yeah, I did a quick google search and it appears that allowing you to access a file

[jQuery] Re: something amiss with json call/file

2009-09-14 Thread mkmanning
It's not jQuery, it's just basic same origin policy. From your example, the calls are cross domain because you were using 'www.pomona.edu' in the getJSON call from 'pomona.edu'. Those are different hosts. On Sep 14, 10:16 am, roryreiff roryre...@gmail.com wrote: The problem ended up being my

[jQuery] Re: Accessing Elements after adding them with Append

2009-09-02 Thread mkmanning
Use .live() http://docs.jquery.com/Events/live#typefn On Sep 2, 1:51 am, Daniel battlew...@googlemail.com wrote: Hi There, I'm having trouble accessing some Elements with jQuery after I created them and added them to the HTML. I want to add some Checkboxes to my Site as soon as the user

[jQuery] Re: JQuery Form - Ajax - Please HELP ! ! ! ! ! ! !

2009-09-02 Thread mkmanning
You could just add name attributes to the text fields (e.g. input type=text id=item_01 name=item_01 class=item_field value=123/ ) and then just use data:$('#myForm').serialize(). That will give you a querystring like: item_01=123item_02=456item_03=789 (you can't pass an array to 'data', it

[jQuery] Re: Do events remain is memory when element is removed from DOM?

2009-09-01 Thread mkmanning
.remove() will also remove all event handlers and internally cached data http://docs.jquery.com/Manipulation/remove#expr On Sep 1, 4:18 pm, roydukkey royduk...@gmail.com wrote: Is it necessary to unbind events from elements before removing them. As like the following:

[jQuery] Re: Replacing like items

2009-08-31 Thread mkmanning
Play around with this: $('input[value*=||]').change(function(){ var $this = $(this),val = $this.val().split('||')[1]; if($this.is(':checked')){ $this.removeAttr('disabled').siblings('input[value$='+val+']').attr ('disabled','disabled'); } else {

[jQuery] Re: Is there a jQuery way to sort span-elements?

2009-08-28 Thread mkmanning
: persons.sorted would give me: [person2,person1,person3] Using Ruby to understand JavaScript is a strange path, but my mind does what it can. -Audrey On Aug 27, 4:49 pm, mkmanning michaell...@gmail.com wrote: I'm gonna go out on a limb and assume you want them sorted alphabetically

[jQuery] Re: Is there a jQuery way to sort span-elements?

2009-08-27 Thread mkmanning
I'm gonna go out on a limb and assume you want them sorted alphabetically, by span content: var sorted = $.makeArray($('#names span')).sort(function(a,b){ return ($(a).text() $(b).text()) ? -1 : 1; }); $('#names').html(sorted); On Aug 25, 9:14 pm, Audrey Lee audrey.lee.is...@gmail.com wrote:

[jQuery] Re: Getting form field values

2009-08-20 Thread mkmanning
I'm assuming you want the current value of the checked checboxes. Just use .serialize() var inputs = $(input[name^='day']).change(function () { console.log(inputs.serialize()); }); the output of serialize() is a query string, just split on '' for an array of key=value that you can then

[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread mkmanning
A couple things that could help in debugging: ID's are unique, and can't begin with a number. Check the quotes on this line around #favorites: var appendHTML = $(‘#favorites’).html(); On Aug 19, 12:48 pm, Rick Faircloth r...@whitestonemedia.com wrote: Hi, Dhruva, and thanks for the reply…

[jQuery] Re: pass different IDs to function?

2009-08-19 Thread mkmanning
Numeric ID's aren't valid, and also an ID can't start with a number. I'd also recommend removing the inline onclick; you can simplify the code by just adding a click event on the UL and delegating: $('#tab_list').click(function(e){ e = $(e.target), i = $(this).find('li').removeClass

[jQuery] Re: how to get back the DOM element as HTML source

2009-08-18 Thread mkmanning
outerHTML is an IE addition to the DOM and not supported by Firefox. If you want to get it with jQuery just append the element to a div and get its html(): $('div').append( $(table:first).clone() ).html() On Aug 18, 4:37 pm, Jules jwira...@gmail.com wrote: Use DHTML property.

[jQuery] Re: Can't get my head around this chain

2009-08-14 Thread mkmanning
@OP: From your example, it appears that the number you want is the categoryid param in the anchor's href. If that's always the case, you could save all the DOM traversing and just extract it from the anchor: $('a:contains(Edit)').click(function(){ var n = /categoryid=(\d+)/.exec(this.href);

[jQuery] Re: Forcing JSON parse by headers

2009-08-05 Thread mkmanning
Well, the easy answer is just send JSON in both cases, with the HTML as part of the JSON response. $.ajax returns the XMLHttpRequest that it creates, so you could get the content type in your success function and eval the JSON yourself: var xhr = $.ajax({ ... success: function(data){

[jQuery] Re: replaceWith()

2009-08-05 Thread mkmanning
The solution doesn't work. $(h2).text() concatenates all the text from every h2 (it would also miss any markup inside the h2). If you want to extract the contents into a variable, then you'll have to iterate over the collection of h2's to do the manipulation. There are other ways to accomplish

[jQuery] Re: accessing iframe content

2009-07-26 Thread mkmanning
Is your iframe on the same domain? If not, you can't do this. On Jul 25, 10:39 am, kknaru isai...@gmail.com wrote: hi there, i just started working with iframes and i'm stucked :D so...i have this code inside a html file: iframe id=myframe          ptext/p /iframe what i'm trying to do

[jQuery] Re: $.browser returning 'wrong' browser version - anyone seen this UA string before?

2009-07-15 Thread mkmanning
You could also just use conditional comments: !--[if IE 6] script src=http://path_to_ie_specific_script.js; type=text/ javascript/script ![endif]-- or set a style within the comments and detect that. On Jul 15, 8:59 am, w1ntermut3 ben.r.ca...@googlemail.com wrote: Thank you :) I'm trying

[jQuery] Re: Add function (transverse)

2009-07-13 Thread mkmanning
Is there another way to accomplish this? $(.post).hover(function () { $(this).find('.category,.comments').show(); }, function () { $(this).find('.category,.comments').hide(); }); On Jul 13, 9:50 am, aakoch outofthem...@gmail.com wrote: I find it frustrating that the

[jQuery] Re: Generating path

2009-07-09 Thread mkmanning
ul has a previous sibling (the h1); I suspect there's a head tag that's the body's previous sibling. In both cases then, prevAll() would result in a length of 1. Also I assume you meant the second paragraph, which starts with In addition to this the earth. On Jul 9, 12:27 am, Shashank

[jQuery] Re: Remove margin in last li in Unordered List

2009-07-09 Thread mkmanning
I did not know about eq and I don't have all fing day to figure this http://docs.jquery.com/Core/index http://docs.jquery.com/Traversing/eq Most everything you will need is in the docs. It's worth spending some time studying them. On Jul 9, 11:52 am, expresso dschin...@gmail.com wrote: I did

[jQuery] Re: Checking value

2009-07-08 Thread mkmanning
FYI this: if ('http://example.com/foo/bar.html' === $('a', $(this)).attr ('href')) { alert('Hooray!'); } is the same as your original code, except for the full url. On Jul 8, 3:25 am, brightdad...@googlemail.com brightdad...@googlemail.com wrote: Yes it worked! On Jul 8, 10:09 am,

[jQuery] Re: how to change 2,5 to 2,50 ?

2009-07-07 Thread mkmanning
There are also some currency formatting plugins: http://plugins.jquery.com/project/currencyFormat (or search currency under plugins) On Jul 7, 3:11 am, weidc mueller.juli...@googlemail.com wrote: hi, thats my code: endpreis =Math.round(endpreis*100)/100; to round the price of something

[jQuery] Re: Ajax call modifying returned html

2009-07-07 Thread mkmanning
The effects functions apply a style of display:block, which causes problems for tables. Try wrapping the table in a div and apply the effect to the div . On Jul 7, 5:45 pm, Will D willb...@gmail.com wrote: I have a similar issue with hiding / showing table data. I have a single table with two

[jQuery] Re: getJSON callback? does not work with querystring param

2009-07-06 Thread mkmanning
For JSONP, the server needs to wrap the response in the supplied callback. The cross-domain getJSON function is basically appending a script to the page, with the contents of that script being a function containing the data you want to pass back. Play around with the URL in the flickr example

[jQuery] Re: getJSON callback? does not work with querystring param

2009-07-06 Thread mkmanning
You mentioned Access to restricted URI denied, which is a cross- domain error. Just as an FYI, making a request to a different port number will trigger this. Something to always keep in mind when working with ajax. On Jul 6, 10:09 am, expresso dschin...@gmail.com wrote: Ok, so their sending

[jQuery] Re: Function to parse query string from URL?

2009-07-05 Thread mkmanning
http://plugins.jquery.com/project/parseQuery (minified it's 449 bytes http://plugins.jquery.com/files/jquery.parsequery.min_.js_.txt) On Jul 5, 1:41 pm, candlerb b.cand...@pobox.com wrote: Hello, a quick question in case I'm being stupid :-) I see that jQuery provides a function to turn

[jQuery] Re: 2 different ways of doing the same thing?

2009-07-04 Thread mkmanning
Yes and no. The first filters out all inputs that are not checkboxes before returning the jQuery object. The second returns all inputs, including checkboxes, and then filters out those that aren't checkboxes. The difference is that with the latter, you can operate on the filtered result, for

[jQuery] Re: 2 different ways of doing the same thing?

2009-07-04 Thread mkmanning
Would this not be 2 different ways to do the same thing? Yes and no. The first finds all inputs and excludes checkboxes, returning the result in the jQuery object. The second finds all inputs and returns them to the jQuery object, then excludes those that are checkboxes. WIth the latter, you

[jQuery] Re: simple JSON parse problem!!!

2009-07-02 Thread mkmanning
uploadPicture{errors:[This file was already uploaded]} isn't valid JSON or JSONP if uploadPicture is a callback function then it needs ( ) : uploadPicture( {errors:[This file was already uploaded]} ); On Jul 1, 9:25 pm, Ricardo ricardob...@gmail.com wrote: No. JSONP provides a way to pass

[jQuery] Re: getJSON 2nd param to pass data

2009-06-29 Thread mkmanning
It uses a GET request, so yes, it converts the name:value pairs into a querystring. Fiddler's fine but you can view the request in Firebug (which overall has more value for web development). On Jun 29, 8:00 pm, expresso dschin...@gmail.com wrote: http://docs.jquery.com/Ajax/jQuery.getJSON I

[jQuery] Re: Float Image on Page

2009-06-29 Thread mkmanning
Quick example: $(document).ready(function(){ var floater = function(){ $('img').animate( {'marginTop':(Math.random() * $(window).height()) + 'px','marginLeft':(Math.random() * $(window).width()) + 'px'}, 2000,'linear',function(){ setTimeout(floater,10); } ); }

[jQuery] Re: getJSON parameter - long string

2009-06-26 Thread mkmanning
In a GET request the length of the URL is also browser dependent. IE has the shortest (at least as of IE7) at 2,083 characters with no more than 2,048 in the path portion. A non-scientific 2006 test showed Firefox to accept at least 100,000 characters, Safari at 80,000 characters, Opera at

[jQuery] Re: Filtering a select list

2009-06-26 Thread mkmanning
Some quick source code: HTML: spanAll/span spanB/span ... spanW/span select size=6 optionBellucci, Monica/option optionBernhardt, Daniel/option optionChou, Collin/option optionFishburne, Laurence/option optionGaye, Nona/option optionHulme, Lachy/option optionLees, Nathaniel/option optionLennix,

[jQuery] Re: Object as Function argument

2009-06-24 Thread mkmanning
If you want a really simple example: function test(o) { var defaults = { test: '' }; for(var k in o){ defaults[k] = o[k]; } alert(defaults.test); } test({test: 'It works!'}); (nb. also assigns new properties to 'defaults')

[jQuery] Re: Accessing window DOM through jQuery Core - can't get it to work

2009-06-24 Thread mkmanning
You're opening a blank window; it has no DOM to manipulate (you'd have to resort to document.write). On Jun 23, 4:29 pm, ieatsleepsurf michael.schwart...@gmail.com wrote: Goal: From window A, I want to manipulate the DOM of window B, where window B is the result of calling window.open(). My

[jQuery] Re: li:nth-child(10) toggle

2009-06-20 Thread mkmanning
I had concocted and work with jQuery 1.3.2. On Jun 19, 9:16 pm, bombaru bomb...@gmail.com wrote: Thanks mkmanning!!!  I'll give this a try tomorrow and let you know. Looking at it though... I'm pretty confident it will do the trick. It's amazing how much more efficiently the original

[jQuery] Re: Accessing the value

2009-06-20 Thread mkmanning
The default value is 'on'. You need to assign a value to each radio; also the selector you're using selects all of the radios without distinguishing between selected or not. Try this to experiment with: $(':radio.star').click(function(){ console.log($(this).val()); }); Your html should

[jQuery] Re: li:nth-child(10) toggle

2009-06-19 Thread mkmanning
Try this: $('.main ul').each(function(){ var $this = $(this), lis = $this.append($('li').text('More').click (function(){ lis.toggle(); $(this).text($(this).text() === 'More' ? 'Less' : 'More'); })).find('li:gt(9):not(:last)').hide(); }); Since you

[jQuery] Re: li:nth-child(10) toggle

2009-06-19 Thread mkmanning
had the $this left over from a different approach :P On Jun 19, 3:59 pm, mkmanning michaell...@gmail.com wrote: Try this: $('.main ul').each(function(){         var $this = $(this), lis = $this.append($('li').text('More').click (function(){                 lis.toggle

[jQuery] Re: Add Class to all form elements

2009-06-18 Thread mkmanning
the fact. On Jun 17, 11:47 pm, Loony2nz loony...@gmail.com wrote: Hi all, Just for clarification, there is only one form on the page at any one time. Thank you all for you thoughts.  I'm going to try them tonite. On Jun 2, 9:40 am, mkmanning michaell...@gmail.com wrote: if you

[jQuery] Re: what is the correct way to test 'display' value in jQuery?

2009-06-18 Thread mkmanning
If you're testing whether an element's display is either 'none' or 'block|inline|static|etc.' (i.e. not 'none') you can also do this: $('#subnav-1').is(':visible') or alternately $('#subnav-1').is(':hidden') Either of these returns a boolean. On Jun 17, 11:20 pm, Jake Barnes

[jQuery] Re: selector, second to last row of table

2009-06-16 Thread mkmanning
A couple quick examples that might help (there're many more ways): console.log( $('table tr:last').prev() ); var trow = $('table tr'); console.log( $(trow[trow.length-2]) ); console.log( trow.eq(trow.length-2) ); Modify the selectors as needed for multiple/nested tables. HTH On Jun 16, 10:46 

[jQuery] Re: Finding items in an UL by their LI's Attributes

2009-06-16 Thread mkmanning
$('ul').find('li[typeref=E][typeid=1]') NB: an id attribute that starts with a number isn't valid markup. On Jun 16, 10:05 am, Paul Hutson hutsonphu...@googlemail.com wrote: Hello, I've been trying to work this out for a bit now but seem to have come a bit unstuck. I'd like to be able to

[jQuery] Re: dynamically add link after certain hrefs

2009-06-16 Thread mkmanning
You can simplify your approach; it's not necessary to copy the properties to the new link as you can just get them at runtime when the link is clicked (you also don't need to iterate over all the anchors): $('a href=/modalwindow.htmlimg src=/images/button.jpg// a').click(function(){ var

[jQuery] Re: How to flip the image?

2009-06-11 Thread mkmanning
The only way currently to do this in Javascript is to use canvas. On Jun 10, 5:27 am, David .Wu chan1...@gmail.com wrote: Can I make image vertical or horizontal flip by jQuery?

[jQuery] Re: jquery find out which option is selected

2009-06-11 Thread mkmanning
The @ before name has been deprecated as of jQuery 1.2 A shortcut for getting (or setting) a form value is $(this).val(); You can use .serialize() to get the values of a form in toto, or for specific form fields: //to get checked values from both groups (assuming they're in a form)

[jQuery] Re: Hide parent where a child contains....

2009-06-11 Thread mkmanning
$(fieldset:has(legend:contains('Promotions'))).hide() On Jun 11, 10:43 am, Jesse jesseainsk...@gmail.com wrote: I'm sure that I'm just missing something simple. Basically, I'm trying the hide the fieldset element if it contains legendPromotions/ legend but I can't get it to work. Here is my

[jQuery] Re: Open div by URL?

2009-06-10 Thread mkmanning
I think the answers, though informative, have gotten off track. If you want to open a specific DIV based on the hash in the URL, just use: var div = window.location.hash; $(div).show(); You should put the necessary checks to make sure there is in fact a hash in the url, etc. On Jun 10, 3:24 

[jQuery] Re: Find text (nodes) within an element?

2009-06-10 Thread mkmanning
Here's a couple other ways: /F$/.test($('label').text()); or $('label').text().substr(-1) === F; On Jun 10, 3:24 pm, ldexterldesign m...@ldexterldesign.co.uk wrote: Easy guys, labelA B C D E F/label Anyone got any tips on how to find out if the last letter of my label is 'F'?

[jQuery] Re: Remove links but not images

2009-06-09 Thread mkmanning
For the example markup you give it's very simple, just do this: $('ul li a').each(function(){ $(this).replaceWith( $(this).children() ); }); On Jun 9, 6:26 am, Adardesign adardes...@gmail.com wrote: Run a .each() to retrieve the images, and delete .remove()  the images and place them

[jQuery] Re: selector question

2009-06-09 Thread mkmanning
$(div:not(#+pid+) form span).css(background-color,yellow); On Jun 9, 8:19 am, squalli2008 m...@paskell.co.uk wrote: Hi, Im trying to select all spans in divs containing forms that dont have a certain id $(div:not([id='#'+pid]) form span).css(background-color, yellow); This selects

[jQuery] Re: selector question

2009-06-09 Thread mkmanning
Yes you do, if you want to filter by ID. Unless the variable pid = #some_id. On Jun 9, 1:29 pm, Danny d.wac...@prodigy.net wrote: You probably don't want the '#' character in there: $(div:not(+pid+) form span).css(background-color,yellow); On Jun 9, 11:45 am, mkmanning michaell...@gmail.com

[jQuery] Re: animate callback scope for infinite loop?

2009-06-08 Thread mkmanning
The above post fails due to this: obj.animate({ opacity:myOpacity}, 500); animation(); The animation() function will be called immediately each time. It should be in obj.animate's callback function. That being said, the OP was asking how to do this without resorting to setTimeout(). To do

[jQuery] Re: who cann't i make it work?my first jquery aspx page

2009-06-07 Thread mkmanning
should be in the head area of the document. No it shouldn't. You can put it in the head if you like, but Javascript blocks downloads, it's ideally a behavior layer that enhances presentation, etc. Much has been written about putting js at the close of the body as a best practice:

[jQuery] Re: ajax.request equivalent in jquery

2009-06-06 Thread mkmanning
You already set the postBody in your first jQuery conversion: data The docs should provide you with all the explanations you need. On Jun 5, 12:31 pm, deex deecodame...@gmail.com wrote: Hey all... I am doing a conversion of prototype to jquery and am stuck on a script... I can't figure out

[jQuery] Re: urgent json parsing error!!!! very important

2009-06-06 Thread mkmanning
It's not a cross-domain security issue, it's a JSONP issue (maybe an authentication issue). Twitter's API allows you to make GET requests which are returned as JSON with an option to specify a callback function. Afaik it doesn't support JSONP however. You can add callback=some_function and the

[jQuery] Re: Moving a div container from within to before a p container

2009-06-06 Thread mkmanning
Waseem's answer doesn't look good for a couple reasons, most importantly calling obj.remove(). That will delete the image from the DOM, which renders every action before it pretty useless :P It also doesn't take into account the OP's request to also include the caption text if it exists. Try

[jQuery] Re: Moving a div container from within to before a p container

2009-06-06 Thread mkmanning
This still won't move the optional caption text (see my post above). On Jun 6, 4:21 pm, Charlie charlie...@gmail.com wrote: One reason I follow this board is to learn how to do things I haven't encountered. I had no idea off top of my head how to do what you want but in quest to learn

[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-05 Thread mkmanning
For FF: window.getSelection().removeAllRanges(); range = document.createRange() range.setStart(YOUR_ELEMENT, start_position); range.setEnd(YOUR_ELEMENT, end_position); //0 window.getSelection().addRange(range); For IE the equivalent is something like: get the range with

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread mkmanning
The problem with parents() in the example given is that if your page structure is more complex, and has nested tables for example, then parents() will return all parent tables. Likewise if there are tr's preceding the tr in your example. Here's a couple ways to get the text you're asking for:

[jQuery] Re: Add Class to all form elements

2009-06-02 Thread mkmanning
is better only if you want certain forms not to have the class name or if you have inputs that are not within forms. On Tue, Jun 2, 2009 at 3:07 AM, mkmanning michaell...@gmail.com wrote: Or you could just do this: $(':input,:checkbox,:radio').addClass('YOUR_CLASSNAME'); On Jun 1, 10:24 am

[jQuery] Re: CSS attributes as a variable.

2009-06-02 Thread mkmanning
$(h1).css({'color':color}); On Jun 2, 11:50 am, jeff jeffreykarbow...@gmail.com wrote: Hello, I am trying to get the color of an element and change the color of another element with that color. Does this make sense? What is wrong with this? I would like all of the H1 tags to inherent the

[jQuery] Re: How to prevent a particular field being submitted in form submission

2009-06-02 Thread mkmanning
To set the value of a form field, use this: $(#myFieldId).val() To do this without setting the field to an empty value, modify your original approach: $(#MyForm).submit(function(){ var params = $(this).serializeArray(); $.post('/register.php',

[jQuery] Re: Add Class to all form elements

2009-06-01 Thread mkmanning
Or you could just do this: $(':input,:checkbox,:radio').addClass('YOUR_CLASSNAME'); On Jun 1, 10:24 am, waseem sabjee waseemsab...@gmail.com wrote: script $(function() { var myforms = $(form); myforms.each(function(i) { var myform = myforms.eq(i); var myfields = $(input, myform);

[jQuery] Re: Apply or remove style - Not workingin IE versions

2009-05-25 Thread mkmanning
If you're html is as you say, you're closing a dl with a div: dl class=entryphp rendered content /div As an aside, why not just chain the js? $('#resume_education dl:first').removeClass('entry').addClass ('first_entry'); On May 24, 7:09 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com

[jQuery] Re: When is jQuery available?

2009-05-23 Thread mkmanning
We've been using jQuery served by Google for almost a year, on a site that gets about 5 million pageviews a month, with no problems. Is your page using https by any chance? On May 22, 3:58 pm, intrader intra...@aol.com wrote: I am having a problem when loading jSquey from the Google CDN as

[jQuery] Re: Question about Tutorial: Find me: Using selectors and events

2009-05-23 Thread mkmanning
A quick look in the jQuery source is always a good start: hover: function(fnOver, fnOut) { return this.mouseenter(fnOver).mouseleave(fnOut); } On May 22, 9:28 pm, Mattsson carol.matts...@gmail.com wrote: Hello, I'm very new to jQuery and trying out some of the

[jQuery] Re: How can i write js equals to $('document').ready()?

2009-05-22 Thread mkmanning
There are other non-library solutions to domready out there: One of the first: http://dean.edwards.name/weblog/2006/06/again/ or taken from Mootools: http://snipplr.com/view/6029/domreadyjs/ etc. Just Google domready, and as Richard said, look at jQuery's source. On May 21, 6:25 pm, Michael

[jQuery] Re: Issue with setting click event functions in a for loop

2009-05-16 Thread mkmanning
You might want to doublecheck that when you click the elements you took out of the loop, you really get what you say. Given your example, if you click #page2 it should alert 'page3' also. You don't really need the loop to attach the click and get at the number if it's part of the id:

[jQuery] Re: Slide to fade, can you help me quick? Noob alert!

2009-05-16 Thread mkmanning
You can make your own: jQuery.fn.fadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle'}, speed, easing, callback); }; Probably a little beyond you right now, but study it and check out the docs. HTH :) On May 16, 9:50 am, Sobering stefan.sober...@gmail.com

[jQuery] Re: Slide to fade, can you help me quick? Noob alert!

2009-05-16 Thread mkmanning
Btw, you could also combine both effects: jQuery.fn.slideFadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback); }; On May 16, 9:49 pm, mkmanning michaell...@gmail.com wrote: You can make your own

[jQuery] Re: efficient way to find a parent

2009-05-06 Thread mkmanning
.parent() gets you the immediate parent of the element, .parents() traverses up through all ancestors, so you could use .parents('.user') and it wouldn't matter how deep you nest the link. You can also use .closest(), which finds the closest parent that matches the specified selector:

[jQuery] Re: How to select all text in a div except ul

2009-05-05 Thread mkmanning
); You'll have to adjust the selector, too, if that div isn't the first   one in your document. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On May 4, 2009, at 9:29 PM, mkmanning wrote: Sorry, maybe my response was somewhat confusing, but I don't believe

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

2009-05-05 Thread mkmanning
(function($) {$.fn.METHOD_NAME = function() {FUNCTION_CODE}}) (jQuery); It's a self-invoking anonymous function passing the global jQuery object as an argument so that it can be referenced inside the function as '$'. $.fn is simply equivalent to $.prototype (which == jQuery.prototype). Google

[jQuery] Re: How To Get Around: Access to restricted URI denied code: 1012

2009-05-05 Thread mkmanning
No options with Ajax cross-domain (for now). If you can change the service to wrap the XML in a function call or assign it to a variable you can use $.getScript(). predefine a function or method: my_function(xml){ //do something with the xml } call .getScript():

[jQuery] Re: problem with wrapper arrays.......

2009-05-05 Thread mkmanning
Accessing the elements by index returns the element itself. To call jQuery methods you'd need to do this: divs = $('div'); div2 = divs[2]; $(div2).addClass('red'); or alternately you could do: div2 = $(divs[2]); div2.addClass('red'); you can also use .eq(#): div2 = divs.eq(2)

[jQuery] Re: How to select all text in a div except ul

2009-05-04 Thread mkmanning
, Karl Swedberg k...@englishrules.com wrote: On May 2, 2009, at 9:28 PM, mkmanning wrote: Don't use .text(), you'll get an array-like object of text nodes. Tiny clarification: you'll get a concatenated string of text nodes. --Karl Karl

[jQuery] Re: any error in the code..... please check

2009-05-02 Thread mkmanning
You spelled function 'funtion' and the first thing you do is return false, so everything after that is ignored--by js and me :) On May 2, 12:39 am, Amit amit.mca...@gmail.com wrote: $(document).ready(         funtion(){         return false;             $(#send).click(                

[jQuery] Re: How to select all text in a div except ul

2009-05-02 Thread mkmanning
Don't use .text(), you'll get an array-like object of text nodes. Try var text = $('div').contents().filter(function(){return this.nodeType==3;}); console.log(text) On May 2, 6:06 pm, nick nboutel...@gmail.com wrote: Thanks for the response. Are you sure thats correct though?

[jQuery] Re: extract base url

2009-05-01 Thread mkmanning
If that's all you need for the search property, then just use window.location.host + '?key=val#' On May 1, 1:39 pm, buntu buntu.w...@gmail.com wrote: Here is an example: I need to append '?key=val1' to the current url which is  www.mysite.com/web/test.html and this I can do using:  

[jQuery] Re: How to select all text in a div except ul

2009-05-01 Thread mkmanning
To get just the text nodes: $('div').contents().filter(function(){return this.nodeType==3;}); If you want to filter out 'empty' nodes: $('div').contents().filter(function(){return this.nodeType==3 this.nodeValue.replace(/\W/g,'')!='';}); Take it from there :) On May 1, 4:06 pm, nick

[jQuery] Re: Animate Variable Concatenate Help

2009-04-30 Thread mkmanning
There is no second half of my function, those are two distinct functions. A variable declared with 'var' in the first one isn't available to the second (without the 'var' it's global and would be available, but that's not recommended). You can use .data() to store the width and retrieve it in the

[jQuery] Re: Grabbing text inside an alt tag

2009-04-29 Thread mkmanning
A couple thoughts: 'alt' isn't a valid attribute of span; use 'title'. Using jQuery doesn't necessarily equate to easier. //POJS for (var i = 0; i elem.length; i++) { if(!elem[i].title){elem[i].title=;} } //jQuery $('span').each(function(){ if(!this.title){this.title=;} }); On Apr 29,

[jQuery] Re: find and replace

2009-04-28 Thread mkmanning
Use a regex: $('body').html( $('body').html().replace(/(that|your)/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

  1   2   3   4   >