Re: [jQuery] Syntax Question

2009-11-17 Thread Michel Belleville
It would help if your function was ready to receive this additional parameter wouldn't it ? var init_number_of_bikes = function(chosen_id) { ... }; Then you could use the value. If someone calls the function and gives no value, it'll be empty (empty is false when used as a boolean in JavaScript).

[jQuery] Syntax Question

2009-11-17 Thread heohni
Hi, I have build a function like this: var init_number_of_bikes = function(){ // Request all avail. bikes var urlextend = findBikes(); $.ajax({ type: "get", url: "./includes/ajax.php?action=getBikes"+

[jQuery] Re: jQuery syntax question

2009-07-14 Thread Matthew
Hi Ricardo, thanks for the clarification, i thought I rememberd seeing the $( $(x)[2] ) syntax somewhere. I like that better than the eq(). My ID's are all good, I just needed the 'body#seniors #text' so only pages in my senior section would be altered, but I guess doing a php if/else would have b

[jQuery] Re: jQuery syntax question

2009-07-13 Thread Ricardo
Well, $( $(x)[2] ) is exactly the same as $(x).eq(2), and eq() is way slower cause it needs to preserve the object and stuff. The point everyone missed is that $(x)[2] gives you a DOM element, not a jQuery object, that's why you need to "rewrap" it in jQuery. Also, IDs should be unique (only one

[jQuery] Re: jQuery syntax question

2009-07-13 Thread Matthew
nevermind my last reply, eq() works great, I just forgot to change my code... here is the code snipet that works (for future reference) jQuery.get("http://www.online-health-insurance.apollobackstage.com/ includes/seniorFreeQuoteBody.php", function(data){ $(

[jQuery] Re: jQuery syntax question

2009-07-13 Thread Matthew
Ok, so eq() seems to work fine, I tried nth-child but im not sure if it worked the way I wanted. When I console.log eq() for the code snipet I provided i get "[p]" does that look right? Here is a DOM example from my page: ... ... .. ... ... ... ... ... Here is my goal with eq(), Im trying

[jQuery] Re: jQuery syntax question

2009-07-13 Thread James
The eq() selector is one way of doing it: http://docs.jquery.com/Selectors/eq On Jul 13, 9:09 am, Matthew wrote: > So it seems like everyday I learn a new way to code the same thing. > What I am trying to do is add some code after a paragraph depending on > how many paragraphs are in the content

[jQuery] Re: jQuery syntax question

2009-07-13 Thread MorningZ
$("p", "body#seniors #text")[2]. does not mean "third paragraph" "nth-child" would be what you could use http://docs.jquery.com/Selectors/nthChild#index On Jul 13, 3:09 pm, Matthew wrote: > So it seems like everyday I learn a new way to code the same thing. > What I am trying to do is add

[jQuery] Re: jQuery syntax question

2009-07-13 Thread Matt Zagrabelny
On Mon, 2009-07-13 at 12:09 -0700, Matthew wrote: > So it seems like everyday I learn a new way to code the same thing. > What I am trying to do is add some code after a paragraph depending on > how many paragraphs are in the content. I'm not to worried about logic > right now just syntax. Here is

[jQuery] jQuery syntax question

2009-07-13 Thread Matthew
So it seems like everyday I learn a new way to code the same thing. What I am trying to do is add some code after a paragraph depending on how many paragraphs are in the content. I'm not to worried about logic right now just syntax. Here is my code: My questions is regarding this syntax: $("p",

[jQuery] Syntax question regarding value of currrent element being clicked.

2008-05-12 Thread Pickledegg
Heres my code: This fires on any dropdown with the class 'ajaxdropdown': However, it errors telling me that event.val() is not a function. How do I refer to the current dropdown being changed, and get its value? I know $ ('#idofdropdown').val() will work, but I need to use multiple dropdowns. $(

[jQuery] syntax question

2008-02-15 Thread Alexandre Plennevaux
hey mates, I didn't find an answer to my week-old question so i'll rephrase to simplify and focus on just the little bit of knowledge i need from you guys: say i want to create a function that performs some jquery methods on an element. function doThis(){ $(this).text('i've been changed')