[jQuery] Re: Finding ID within Ajax response
Hey Nic, I have a couple small recommendations- hopefully one will fix the issue. Try using $.get() instead of $.ajax, and specify "type" option as "html"- alternatively, you can use $.load() if your ultimate purpose is to inject this HTML into DOM. In addition rather than using find(), just select by ID as a subset of the DOM node.. alert($(html).find("#test") becomes alert($("#test", html)); Hope some of this helps... cheers! Nic Luciano Senior Web Developer @ AdaptiveBlue http://www.twitter.com/nicluciano http://www.linkedin.com/in/nicluciano On Mon, Apr 13, 2009 at 3:35 PM, Nic Hubbard wrote: > > Nope, that does not work either. > > On Apr 13, 12:20 pm, Jack Killpatrick wrote: > > Maybe try: > > > > success: function(html){ > > alert($(html).find('form').attr('action')); > > > > I had some issues in the past using form id's with the jquery form > > plugin, but usually getting it using 'form' worked. > > > > That said, since the response isn't in the DOM yet, I'm not sure if that > > might present an issue (too/instead). > > > > - Jack > > > > Nic Hubbard wrote: > > > Yes, this is very odd. I have tried it quite a few ways, but I can > > > never target the form. Any other ideas? > > > > > It is frustrating because I really need to target a form in the html > > > response... > > > > > On Apr 13, 11:45 am, James wrote: > > > > >> That's strange. I can't get it to work either and I'm getting the same > > >> results as you (I can get #test2, but not #test). I've even truncated > > >> the response down to as if you're only receiving the part and > > >> it still doesn't work. I'd be interested in seeing what happens here > > >> too. > > > > >> On Apr 13, 6:47 am, Nic Hubbard wrote: > > > > >>> Test page to show the problem:http://www.puc.edu/dev/tests/ajax-test > > > > >>> On Apr 13, 9:33 am, Nic Hubbard wrote: > > > > >>>> I am pulling my hair out over this. I swear that this is a bug. > > > > >>>> For some reason, I CANNOT target any forms within the html response. > > >>>> I have tried very simple examples and it still won't work. Here is > > >>>> what I have, that still returns undefined: > > > > >>>> HTML: > > >>>> http://test.com";> > > >>>> this is my text > > >>>> > > > > >>>> jQuery: > > >>>> success: function(html){ > > >>>> alert($(html).find("#test").attr('action')); > > >>>> alert($(html).find("#test2").text()); > > > > >>>> } > > > > >>>> #test2 works, but #test never does, and it seems this is because it > is > > >>>> a form. Have I done something wrong here? Can I not target a form? > > > > >>>> On Apr 12, 4:35 pm, Nic Hubbard wrote: > > > > >>>>> I have an ajax GET call that returns the HTML of a page on my > server. > > >>>>> Within that page is a form with a specific ID. I know it is there, > I > > >>>>> can see it in the response in Firebug, but when I try to get > > >>>>> attributes of that ID, it always returns undefined! What have I > done > > >>>>> wrong here? > > > > >>>>> success: function(html){ > > > > >>>>> $(html).find('#main_form').each(function() { > > >>>>> var linking_data = $(this).serialize(); > > >>>>> var form_action = $(this).attr('action'); > > >>>>> alert(form_action); > > > > >>>>> }); > > >>>>> } > > > > >>>>> I have tried to not use each() and that still returns undefined. I > > >>>>> don't get it. >
[jQuery] Re: Accessing a JSON property from an unknown variable?
Oh wow, I didn't realize JSON would act like an associative array in that way... Thanks guys! On Fri, Feb 13, 2009 at 7:10 PM, Josh Nathanson wrote: > > foo[fooProp] // returns "barVal" > > Is that what you mean? > > -- Josh > > > > -Original Message- > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > Behalf Of Nic > Sent: Friday, February 13, 2009 4:06 PM > To: jQuery (English) > Subject: [jQuery] Accessing a JSON property from an unknown variable? > > > For instance, > > var foo = { > "bar": "barVal", > "baz": "bazVal" > } > > var fooProp = "bar"; > > How can I access barVal through fooProp? > > I know this isn't exactly jQuery group discussion but I figured since > it was part of a jQuery system I could get away with it. Thanks! > >
[jQuery] Re: Removing all styles from an element-
I considered it, but because of the ambiguity I run into I just need to specify every single Css property... Thought there might be something clever I could do with jquery but pobably not... Thanks Sent from my iPhone On Feb 12, 2009, at 12:08 AM, Ricardo Tomasi wrote: You could a use kind of "CSS reset" for your container. I usually don't like '*' declarations but this seems fit here: #myModule * { margin:0; padding:0; font-family:Arial; color:#000; height:auto; width:auto } On Feb 11, 11:09 pm, Nic wrote: The scenario: I am developing a module that will live on any page it's requested to live on (any website). The issue is that if the website it's on has a broad style definition (ie. p { margin: 20px; }), this will affect my elements (in addition to the styles I define). Is there a way I can ensure that only the styles I apply are used, or to clear all styles of my elements before I apply my own? So if someone has such a definition on their page, it won't effect my module. I know I could explicitly redefine the style myself, but there is no way of telling ahead of time what styles will be defined (without defining every single css property for every single element)- so a catch all would be nice. Thanks, Nichttp://www.twitter.com/nicluciano Sent from my iPhone
[jQuery] Re: $.getScript - passing the response.
Close but You should be using .get() for this, with an onsuccess callback (also see datatype). .getscript is solely for loading javascript files to execute. Sent from my iPhone On Feb 11, 2009, at 11:13 PM, "brian.overl...@gmail.com" > wrote: I'm using $.getScript to get XML from a remote server. How do I pass the response text from that request to another function? Here's the pseudocode: $.getScript(getURL, function(){ processXML(); }); How do I pass the response text to processXML? Thanks!
[jQuery] Re: Status Codes => docs
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html Something like this? I might be misunderstanding your question, but I don't think statuses and datatypes are related if that's what you mean. Status codes (linked) are the status of the call.. (ie. a return status of 200 means everything went OK). Data type is the format of the data you are expecting to return (html for plain html to insert into your document, json for js objects, etc)... Nic Luciano http://www.twitter.com/nicluciano http://www.linkedin.com/in/nicluciano On Wed, Feb 11, 2009 at 8:52 PM, Tim Johnson wrote: > > I would be grateful if someone could point me to documentation > on status codes. > > Example: $post() expects a callback function whose second argument > would be status. > What statuses should I expect and what datatype for statuses > should I expect. > Links to docs would be more than adequate. > > _Thanks In Advance_ and thanks for all the help I've had so far. > tim >
[jQuery] Re: how to include JQuery from a page loaded by AJAX?
You should think about using jQuery's ajax ( http://docs.jquery.com/Ajax/jQuery.ajax#options) while you're at it... if you did, you could attach your .corners() function to ajaxComplete ( http://docs.jquery.com/Ajax/ajaxComplete#callback) so you wouldn't have to include it in every call. Glad to help !! On Wed, Feb 11, 2009 at 10:46 PM, Davis wrote: > > Hello Nic, > > THAT IS VERY HELPFUL, it work fine once after I put those JS/jquery > after ajax callback. > > THANKS very much of you and Donkeybob those previous help. > > thanks/Davis.
[jQuery] Re: A small incompatibility about selector on Jquery 1.3.1
Hey Jack- I think this is the right group for these issues:... :) http://groups.google.com/group/jquery-dev Nic Luciano http://www.twitter.com/nicluciano http://www.linkedin.com/in/nicluciano On Wed, Feb 11, 2009 at 9:53 PM, jack wrote: > > The following works on before Version: > $('#zz input:not([readonly]):first').focus().select() > > On Ver 1.3.1, it won't work unless you change to: > $('#zz input:not([readonly=""]):first').focus().select() > > >
[jQuery] Re: how to include JQuery from a page loaded by AJAX?
PS - Again, I don't even know for sure if this is the issue. :) On Wed, Feb 11, 2009 at 10:32 PM, Nic Luciano wrote: > Hey Davis... > > So, the issue is that your calling corners once, it executes on all the > elements currently IN the document. When you load new elements via AJAX, > they are appended AFTER corners has already done it's magic. > > So where it says... > > if (xmlHttp.readyState == 4){ > var res = xmlHttp.responseText; > loader_menu.innerHTML = res; > > } else { > loader_menu.innerHTML = ' src="./templates/current-version/images/page-loading.gif" > style="margin:5px;" alt="loading" />'; > } > > You need to reapply .corners() > > if (xmlHttp.readyState == 4){ > var res = xmlHttp.responseText; > loader_menu.innerHTML = res; > $('#guestbook').corners({radio:5, outColor:'red'}); > } else { > loader_menu.innerHTML = ' src="./templates/current-version/images/page-loading.gif" > style="margin:5px;" alt="loading" />'; > } > > > On Wed, Feb 11, 2009 at 10:26 PM, Davis wrote: > >> >> Hello Nic, >> >> Thanks for your quick reply. >> >> So would you please give me some simple example about callback ajax >> script ? also what do you meant using own AJAX function co-operate >> with jquery? sorry I am still newbie for ajax and jquery. >> >> many thanks/Davis. > > >
[jQuery] Re: how to include JQuery from a page loaded by AJAX?
Hey Davis... So, the issue is that your calling corners once, it executes on all the elements currently IN the document. When you load new elements via AJAX, they are appended AFTER corners has already done it's magic. So where it says... if (xmlHttp.readyState == 4){ var res = xmlHttp.responseText; loader_menu.innerHTML = res; } else { loader_menu.innerHTML = ''; } You need to reapply .corners() if (xmlHttp.readyState == 4){ var res = xmlHttp.responseText; loader_menu.innerHTML = res; $('#guestbook').corners({radio:5, outColor:'red'}); } else { loader_menu.innerHTML = ''; } On Wed, Feb 11, 2009 at 10:26 PM, Davis wrote: > > Hello Nic, > > Thanks for your quick reply. > > So would you please give me some simple example about callback ajax > script ? also what do you meant using own AJAX function co-operate > with jquery? sorry I am still newbie for ajax and jquery. > > many thanks/Davis.
[jQuery] Re: how to include JQuery from a page loaded by AJAX?
You need to be executing the Javascript in the callback of your AJAX function, NOT in the head of the document you are loading. Aside, if you are using jQuery anyway you should consider using it's own AJAX functions... On Wed, Feb 11, 2009 at 10:06 PM, Davis wrote: > > hello, > > first, i just want to make sure it will trigger any JS from that AJAX > loaded page. > so i just put a single JS code without anything else inside loaded > page, but it didnt trigger that alert() JS, what can i test it > further ? > > alert('z'); > > thanks/Davis.
[jQuery] Re: Finding the last sibling.
$("div :last-child"); (or this wacky way I tried before I learned CSS selectors $("div").children()[$("div").children().size() - 1])...) Nic Luciano http://www.twitter.com/nicluciano http://www.linkedin.com/in/nicluciano On Wed, Feb 11, 2009 at 9:49 PM, Risingfish wrote: > > Hi James, apologize for not being more precise. I'm using the input > element as my base reference. So using that input element, I want to > get the last sibling under the div. You are correct that if the span > is not then the input is what I want. I may need to add more tags > later (I'm sure you know hoe the development process goes when > customers are involved. :) ), so a reliable way to get the last tag > would be nice. Thanks! > > On Feb 11, 7:21 pm, James wrote: > > When you say "last sibling in a parent", what does that mean? Which > > element is your base reference? > > > > In your example: > > > > > > ... > > > > > > Do you mean your is the base reference, and you want to find the > > last child (thus, ) relative to that? > > And if is not there, you want ? > > > > On Feb 11, 4:12 pm, Risingfish wrote: > > > > > Before I accidentally hit enter, this is what I was trying to type: :) > > > > > > > > > > > ... > > > > > > > > The span might or might not be there, so I would like to just get the > > > last sibling in a parent. > > > > > Thanks! >
[jQuery] Re: how to include JQuery from a page loaded by AJAX?
The reason, if I had to guess without playing with it, is that your .corners() execution is run on load, and sets some styles inline. When your new elements are loaded, they don't have these inline styles (because they were just appended). If this is the case, is right after you append the data in your success callback, just re-execute your .corners() function. If that's not right it should point you in the right direction... cheers! Nic Luciano http://www.twitter.com/nicluciano http://www.linkedin.com/in/nicluciano On Wed, Feb 11, 2009 at 9:35 PM, Davis wrote: > > hello Donkeybob, > > many thanks for your reply. > > I just use standard AJAX call a php and render xmlHttp.responseText > ( return from php ) result back to the page. AJAX approach work fine > without jquery inside any normal page loading. > > also, i tested include a JS alert() inside a AJAX loaded page, it > seems didnt trigger that JS at all...I thought it just normal load a > page and then run those JS inside that page, but no luck..:( > > function display_nickpage_tab_content(uid,pid,tab_id,tab_page){ > >xmlHttp = GetXmlHttpObject() > >if(xmlHttp == null){ >alert ("Your browser does not support AJAX!"); >return; > } > >xmlHttp.onreadystatechange = function(){ > >var loader_menu = document.getElementById > ('x_nickpage_tab_loading_'+pid); >if (xmlHttp.readyState == 4){ >var res = xmlHttp.responseText; >loader_menu.innerHTML = res; > >} else { >loader_menu.innerHTML = ' src="./templates/current-version/ > images/page-loading.gif" style="margin:5px;" alt="loading" />'; >} > >} > >var url = "ajax-display-nickpage-tab-content.php"; >var params = "uid="+uid >+"&pid="+pid >+"&tab_id="+tab_id >+"&tab_page="+tab_page >+ ""; > >xmlHttp.open("POST",url,true); >xmlHttp.setRequestHeader("Content-type", "application/x-www-form- > urlencoded"); >xmlHttp.setRequestHeader("Content-length", params.length); >xmlHttp.setRequestHeader("Connection", "close"); >xmlHttp.send(params); > > } > > many thanks for your help./Davis.
[jQuery] Re: how to differentiate between "click" and "dragend" events?
Try starting a timer on mouse down, and only register the click event if the timer is less than x milliseconds. The fringe case for this would be users who click for seconds, or who drag in milliseconds. I'm .positive. this is not the best possible way to handle this, but it could be a last resort. Nic http://www.twitter.com/nicluciano Sent from my iPhone On Feb 11, 2009, at 7:43 PM, legofish wrote: no takers? On Feb 11, 1:54 pm, legofish wrote: Hi, I am using the "drag" plugin (http://blog.threedubmedia.com/2008/08/ eventspecialdrag.html) to design some interactions for a UI element. The element foo, needs to respond to a click, as well as to a drag (different responses for each). The plugin gives you handy drag events to work with. So I have: $("#foo").bind('dragend', function(e){ dragged() }); $("#foo").bind('click', function(e){ clicked() }); When foo is simply clicked on, then clicked() is executed and all is well. However, when foo is dragged, dragged() is called and right after that clicked() is called as well. I don't want clicked() to be called when foo is dragged, but I can't seem to figure out how to avoid that. Help is much appreciated.
[jQuery] Re: Click Links in the Nnavigation Bar
What exactly are you trying to do, what is the issue? Maybe just preference here (and I'm also just guessing what you're asking) but I don't see a reason not to put the events on the elements themselves $("ul li a").click(function() { $(this).parent().parent().find(".active").removeClass("active"); $(this).addClass("active"); }); On Fri, Jan 30, 2009 at 3:07 AM, Pedram wrote: > > Dear Karl , > I know You are Expert in these Issues do you have any idea for me > Thanks > > On Jan 29, 5:44 pm, Pedram wrote: > > Hi Folks , > > I have some links in my Navigation bar such as below , I Used FIND > > in my code , does anyone has any better solution for me , > > I also used Event Delegation in the system . > > > > > > b > > c > > d > > > > > > $("ul").bind("click",function(e){ > > var clicked=$(e.target); > > $(this).find("a.active").removeClass("active"); > > clicked.addClass("active"); > > }); >
[jQuery] Re: var divcount = $("div#div2").length; --- returns wrong value
Hey Bartee, I think your problem is that .length() returns the number of elements in the object you're acting on. In you're case, there's only one object (a text node). So, it should return one. What you're actually looking for is $("div#div2").text().length; On Mon, Jan 19, 2009 at 12:25 PM, bartee wrote: > > My alert always returns "1" as the divcount value ??? > > What's up with that.. I have read and tried bunches of things. > > What am I missing > > > http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en-AU"> > > Jquery Test > > >$(function() { > var divcount = $("div#div2").length; > alert("start=" + divcount); >}); > > > > asdf > asdf > asdf > > >
[jQuery] Re: rating using thumbs up thumbs down.
It's unlikely there's a plugin to do what you want to do since javascript is client side, and saving to any sort of database would require at least some web service. On Sun, Jan 18, 2009 at 12:46 PM, Pragan wrote: > > Hi, > > I am looking to implement a rating system using thumbs up thumbs down. > So far with my search, I was able to find only star rating system. I > would like to do the following thing: > 1) Show two images(one for up and one for down). > 2) when clicked, it has to store the count in the mysql db and show a > message saying "thanks and hide the images. > 3) I like to have just four fields : 1) id 2) URL 3) UP 4) DOWN > id - primary key > URL - site for which it has been rated > up -increase the count if this is clicked in any url where the script > is implemented. > down - increase the count if this is clicked in any url where the > script is implemented > > Example: > id | url | up | down > 1abc.com 22 34 > 2example.com 10 6 > > > Please let me know, if there is any plugin that already exists which I > use to learn or how to do this. I am trying to avoid a page refresh so > I prefer to just show the thanks message. > I can explain it again, if this is not clear. > > > thanks > pragan >
[jQuery] Re: jQuery in a Firefox Extension...
Anyone? I was looking forward to using jQuery in the extension but I might have to do without... :[ On Fri, Jan 16, 2009 at 3:47 PM, Nic Luciano wrote: > Hm, that makes sense. So, I suppose I could do something like > > jQuery.noConflict(); > var doc = window.content.document; > jQuery("#id", doc); > > Which would solve the issue that jQuery doesn't live in the HTML anymore > (and lives in the browser). But how would this work on .ajax functions? Do I > have to edit the instantiation/references in the first couple lines of > jQuery to point somewhere other than window? Or will functions like .ajax > (that don't browse the DOM) only work when there is a document to access (as > opposed to on load of Firefox)? > > Thanks- > > > On Fri, Jan 16, 2009 at 9:29 AM, Eric Garside wrote: > >> >> I'm pretty sure the problem is that jQuery is defining itself in it's >> header section as something like window.jQuery = jQuery = $ or some >> such referential transitive equation strand. I'm not an expert at FF >> plugins, but I have gone through the motions of building one that >> modified current pages only. And to get to that page, you had to >> invoke a special call to get access to the current tabs current page >> html. >> >> I'd look into that, and get to the point where you can alert the >> innerHTML of a page element. That's how I first started to learn it. I >> just wish I hadn't already forgotten. :P >> >> On Jan 15, 11:37 pm, Nic wrote: >> > It seems like this has been asked a million times, but nothing seems >> > to answer my question. >> > >> > I include it in my .xul above my other scripts- (I checked the >> > location and it's correct). >> > >> > It's the first time I've used jQuery in an extension, so I'm trying to >> > run some commands on load just to see if it works. The following below >> > throws no exceptions: >> > >> > window.addEventListener("load", function() { init(); }, false) >> > var init = function() { >> > try { >> > jQuery.noConflict(); >> > } catch(e) { alert(e); } >> > >> > } >> > >> > Below I'll list a bunch of things I tried with their respective errors >> > to maybe help give a glimpse into whats going on... What's going on >> > here? I'm sure it's something obvious, or simple... >> > >> > The following: >> > >> > window.addEventListener("load", function() { init(); }, false) >> > var init = function() { >> > try { >> > jQuery.noConflict(); >> > alert(jQuery("body")); >> > } catch(e) { alert(e); } >> > >> > } >> > >> > Throws: >> > >> > TypeError: n.find is not a function >> > >> > The Following: >> > >> > window.addEventListener("load", function() { init(); }, false) >> > var init = function() { >> > try { >> > $.getJSON("http://www.google.com/";, function(data) { >> > alert(data); >> > }); >> > } catch(e) { alert(e); } >> > >> > } >> > >> > Throws: >> > TypeError: $.getJSON is not a function >> > >> > The Following: >> > >> > window.addEventListener("load", function() { init(); }, false) >> > var init = function() { >> > try { >> > jQuery.noConflict(); >> > jQuery.getJSON("http://www.google.com/";, function(data) >> { >> > alert(data); >> > }); >> > } catch(e) { alert(e); }} >> > >> > Throws: >> > TypeError: jQuery.getJSON is not a function >> > >> > Thanks, guys! >> > >
[jQuery] Re: How select first link??
Ah, Karl, I see the issue now. I was also confused with the original usage since the discussion was about :first but he was using :first-child. So let me ask, in your test, li a:first should only return one element (as per docs, :first should always only return one element), correct? And first-child would be what I originally expected (returning 7 links)? Can't believe I overlooked that- I stand corrected :D On Sat, Jan 17, 2009 at 4:13 PM, Ricardo Tomasi wrote: > > I know this isn't the dev list, but I'm curious about how come these > bugs weren't caught by the test suite? > > On Jan 17, 6:50 pm, Karl Swedberg wrote: > > Nic, > > Actually, it is a bug, at least in the sense that the results are > > different from those of any previous version of jQuery. > > > > It isn't just about :first, though. It has to do with multiple- > > descendant selectors in general. I've provided a test case athttp:// > test.learningjquery.com/selector-bug.html > > with side-by-side comparison of 1.2.6 and 1.3, showing the number of > > matches (and I also posted an update to the ticket). > > > > --Karl > > > > ____ > > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > > > On Jan 17, 2009, at 3:39 PM, Nic Luciano wrote: > > > > > That's true, but that's exactly how it's supposed to function. > > > > > On Sat, Jan 17, 2009 at 3:35 PM, jQuery Lover > > > wrote: > > > > > No he is not! > > > > > Suppose you have this scenario: > > > > > > > > > > > Home > > > Rules > > > Pilots > > > Briefing > > > IGC > > > Results > > > Forum > > > > > > > > > > > $('#menu li:first a').remove() - will do nothing here, since first li > > > has no anchor in it ! > > > > > > > > Read jQuery HowTo Resource - http://jquery-howto.blogspot.com > > > > > On Sun, Jan 18, 2009 at 1:28 AM, Charlie22 wrote: > > > > > > Well, you are right, thx for explanation. Now it is clear!! > > > > > > On 17 Led, 21:04, Pedram wrote: > > > >> hi Guys , I know what should you do , > > > >> $('#menu li:first a').remove() > > > >> this is the code you need , jquery has no problem when you use this > > > >> code $('#menu li a:first').remove(); the selector checks each li > > > and > > > >> removes the so all of the links will be removed so in your case > > > >> your code should look like this $('#menu li:first a').remove(); > > > the > > > >> selector selects the first li and removes the > > > >> that set, > > > >> I am just following john Resig in twitter it seems he is going to > > > >> release jquery 1.3.1 maybe he found some little bugs. >
[jQuery] Re: How select first link??
That's true, but that's exactly how it's supposed to function. On Sat, Jan 17, 2009 at 3:35 PM, jQuery Lover wrote: > > No he is not! > > Suppose you have this scenario: > > > >Home >Rules > Pilots > Briefing > IGC > Results > Forum > > > > $('#menu li:first a').remove() - will do nothing here, since first li > has no anchor in it ! > > > Read jQuery HowTo Resource - http://jquery-howto.blogspot.com > > > > On Sun, Jan 18, 2009 at 1:28 AM, Charlie22 wrote: > > > > Well, you are right, thx for explanation. Now it is clear!! > > > > On 17 Led, 21:04, Pedram wrote: > >> hi Guys , I know what should you do , > >> $('#menu li:first a').remove() > >> this is the code you need , jquery has no problem when you use this > >> code $('#menu li a:first').remove(); the selector checks each li and > >> removes the so all of the links will be removed so in your case > >> your code should look like this $('#menu li:first a').remove(); the > >> selector selects the first li and removes the > >> that set, > >> I am just following john Resig in twitter it seems he is going to > >> release jquery 1.3.1 maybe he found some little bugs. >
[jQuery] Re: How select first link??
Simple correction, I meant the first child of it's parent*. Just in case it wasn't clear. Cheers- Nic http://www.twitter.com/nicluciano On Sat, Jan 17, 2009 at 2:05 PM, Nic Luciano wrote: > The reason it's not working is you're using the first-child selector. What > you're doing by using that is selecting every anchor that is the first > parent of it's child (which is all of them since they lie immediately under > a list item). The selector you want to be using is just first (a:first), > which will return the first matched element on the document only. > > Cheers- > Nic > http://www.twitter.com/nicluciano > > > On Sat, Jan 17, 2009 at 1:56 PM, Charlie22 wrote: > >> >> IE7, FF3, GoogleChrome..ok, check this page >> http://83.240.47.84/skyrace2/del.html >> >> On 17 Led, 19:41, jQuery Lover wrote: >> > What browser are you using? I am using firefox 3.0.5 and jquery 1.3 >> > and it is working!!! >> > >> > I have just triple checked... >> > >> > $('#menu a:first').remove(); >> > >> > removes the first anchor in the list. >> > >> > >> > Read jQuery HowTo Resource - http://jquery-howt.o.blogspot.com >> >. >> > >> > >> > On Sat, Jan 17, 2009 at 11:33 PM, Charlie22 wrote: >> > >> > > of i add .remove() of course >> > >> > > On 17 Led, 19:32, Charlie22 wrote: >> > >> I tested it, but it remove all "a", so sry, it doesnt work :-( >> > >> > >> On 17 Led, 19:21, jQuery Lover wrote: >> > >> > >> > Removing li solves the problem: >> > >> > >> > $('#menu a:first'); >> > >> > >> > >> > >> > Read jQuery HowTo Resource - http://jquery-howto.blogspot.com >> > >> > >> > On Sat, Jan 17, 2009 at 11:09 PM, Charlie22 wrote: >> > >> > >> > > Hi all, I am playing with jQuery 1.3 and I have provlem with >> selecting >> > >> > > a first link in code below. Can you help me how how it should >> look >> > >> > > like jQuery code and also for case, if Home will not be a link, >> so >> > >> > > "Rules" will be a first link. My traditional way from jQuery >> 1.2.6 >> > >> > > doesnt work now. ('#menu li a:first') >> > >> > >> > > Thx for help in advance. >> > >> > >> > > >> > >> > > >> > >> > >Home >> > >> > >Rules >> > >> > >Pilots >> > >> > >Briefing >> > >> > >IGC >> > >> > >Results >> > >> > >Forum >> > >> > > >> > >> > > - Skrýt citovaný text - >> > >> > >> > - Zobrazit citovaný text -- Skrýt citovaný text - >> > >> > >> - Zobrazit citovaný text -- Skrýt citovaný text - >> > >> > - Zobrazit citovaný text - > > >
[jQuery] Re: How select first link??
The reason it's not working is you're using the first-child selector. What you're doing by using that is selecting every anchor that is the first parent of it's child (which is all of them since they lie immediately under a list item). The selector you want to be using is just first (a:first), which will return the first matched element on the document only. Cheers- Nic http://www.twitter.com/nicluciano On Sat, Jan 17, 2009 at 1:56 PM, Charlie22 wrote: > > IE7, FF3, GoogleChrome..ok, check this page > http://83.240.47.84/skyrace2/del.html > > On 17 Led, 19:41, jQuery Lover wrote: > > What browser are you using? I am using firefox 3.0.5 and jquery 1.3 > > and it is working!!! > > > > I have just triple checked... > > > > $('#menu a:first').remove(); > > > > removes the first anchor in the list. > > > > > > Read jQuery HowTo Resource - http://jquery-howt.o.blogspot.com > >. > > > > > > On Sat, Jan 17, 2009 at 11:33 PM, Charlie22 wrote: > > > > > of i add .remove() of course > > > > > On 17 Led, 19:32, Charlie22 wrote: > > >> I tested it, but it remove all "a", so sry, it doesnt work :-( > > > > >> On 17 Led, 19:21, jQuery Lover wrote: > > > > >> > Removing li solves the problem: > > > > >> > $('#menu a:first'); > > > > >> > > > >> > Read jQuery HowTo Resource - http://jquery-howto.blogspot.com > > > > >> > On Sat, Jan 17, 2009 at 11:09 PM, Charlie22 wrote: > > > > >> > > Hi all, I am playing with jQuery 1.3 and I have provlem with > selecting > > >> > > a first link in code below. Can you help me how how it should look > > >> > > like jQuery code and also for case, if Home will not be a link, so > > >> > > "Rules" will be a first link. My traditional way from jQuery 1.2.6 > > >> > > doesnt work now. ('#menu li a:first') > > > > >> > > Thx for help in advance. > > > > >> > > > > >> > > > > >> > >Home > > >> > >Rules > > >> > >Pilots > > >> > >Briefing > > >> > >IGC > > >> > >Results > > >> > >Forum > > >> > > > > >> > > - Skrýt citovaný text - > > > > >> > - Zobrazit citovaný text -- Skrýt citovaný text - > > > > >> - Zobrazit citovaný text -- Skrýt citovaný text - > > > > - Zobrazit citovaný text -
[jQuery] Re: Solution To Many Of Your CSS Nightmares!
This might work for Superfish but isn't it also a possibility by doing this you could do the exact opposite of what you're trying to accomplish, as this could also override any other third party CSS you're trying to use? While I guess it's not technically incorrect, there's no reason to include !important in every one of your properties. If you must, it should only be done on elements that require it to function correctly. Ideally, you should just modify your CSS to not even use this on your properties (via unique names, inheritance, etc)... Cheers- Nic http://www.twitter.com/nicluciano On Sat, Jan 17, 2009 at 12:31 AM, johny why wrote: > > trying to integrate a 3rd party css candy into your site may result in > conflicts between the candy's css and your site's css, resulting in a > rendering mess. stuff that works beautifully by itself blows up when > you put it into your website. this trick may not find you a new > girlfriend, or butter your bread on both sides, !BUT¡ it may > instantly eliminate your css conflicts. it instantly eliminated ALL of > the rendering conflicts i was having with superfish (and other css > menus), when trying to integrate them into my site. > > SOLUTION: > open all your css files, and globally replace: ";" with " !important;" > > THAT'S IT! > > (don't forget the space before !important;) > > for example, this: > > top: -999em; > > will become: > > top: -999em !important; > > HOW IT WORKS: > the "!important" property forces that style to override all other css, > whether style-sheets, inline-css, header-styles, and whether above or > below in the css hierarchy. > > badabing! > > http://users.tpg.com.au/j_birch/plugins/superfish/ > http://inyourear.org
[jQuery] Re: jQuery in a Firefox Extension...
Hm, that makes sense. So, I suppose I could do something like jQuery.noConflict(); var doc = window.content.document; jQuery("#id", doc); Which would solve the issue that jQuery doesn't live in the HTML anymore (and lives in the browser). But how would this work on .ajax functions? Do I have to edit the instantiation/references in the first couple lines of jQuery to point somewhere other than window? Or will functions like .ajax (that don't browse the DOM) only work when there is a document to access (as opposed to on load of Firefox)? Thanks- On Fri, Jan 16, 2009 at 9:29 AM, Eric Garside wrote: > > I'm pretty sure the problem is that jQuery is defining itself in it's > header section as something like window.jQuery = jQuery = $ or some > such referential transitive equation strand. I'm not an expert at FF > plugins, but I have gone through the motions of building one that > modified current pages only. And to get to that page, you had to > invoke a special call to get access to the current tabs current page > html. > > I'd look into that, and get to the point where you can alert the > innerHTML of a page element. That's how I first started to learn it. I > just wish I hadn't already forgotten. :P > > On Jan 15, 11:37 pm, Nic wrote: > > It seems like this has been asked a million times, but nothing seems > > to answer my question. > > > > I include it in my .xul above my other scripts- (I checked the > > location and it's correct). > > > > It's the first time I've used jQuery in an extension, so I'm trying to > > run some commands on load just to see if it works. The following below > > throws no exceptions: > > > > window.addEventListener("load", function() { init(); }, false) > > var init = function() { > > try { > > jQuery.noConflict(); > > } catch(e) { alert(e); } > > > > } > > > > Below I'll list a bunch of things I tried with their respective errors > > to maybe help give a glimpse into whats going on... What's going on > > here? I'm sure it's something obvious, or simple... > > > > The following: > > > > window.addEventListener("load", function() { init(); }, false) > > var init = function() { > > try { > > jQuery.noConflict(); > > alert(jQuery("body")); > > } catch(e) { alert(e); } > > > > } > > > > Throws: > > > > TypeError: n.find is not a function > > > > The Following: > > > > window.addEventListener("load", function() { init(); }, false) > > var init = function() { > > try { > > $.getJSON("http://www.google.com/";, function(data) { > > alert(data); > > }); > > } catch(e) { alert(e); } > > > > } > > > > Throws: > > TypeError: $.getJSON is not a function > > > > The Following: > > > > window.addEventListener("load", function() { init(); }, false) > > var init = function() { > > try { > > jQuery.noConflict(); > > jQuery.getJSON("http://www.google.com/";, function(data) > { > > alert(data); > > }); > > } catch(e) { alert(e); }} > > > > Throws: > > TypeError: jQuery.getJSON is not a function > > > > Thanks, guys! >