[jQuery] Noob question about wrapped sets
Going through the tutorials on this website and others, I've found some syntax that I don't understand and is never explained. Usually wrapped sets look like this: $(#myElement) But once in a while they look like this $(#myElement)[0] Here are a few examples of it in use: $("div").index($("div#myDiv")[0]); $("#myImage")[0].alt; I don't get it. The sample code is NEVER trying to find the first element of an array. From my POV this format seems completely random and unnecessary, yet the jQuery code will NOT work if the "[0]" is removed. I know it's something glaringly obvious and I'll feel stupid when I get the answer, but my god, I just can't figure out the pattern here. Please help.
[jQuery] noob question, computability issues with a different date picker
Hello everyone, I tried posting a message before, but it didn't get posted, so here's another go. I'm completely new to jquery development and I wanted to use this date picker, since it also uses time as well http://razum.si/jQuery-calendar/TimeCalendar.html However, it did not say what to do, how, or where to change or add the code of his particular date picker with the standard one given in the UI code provided (his code is given through page source, then at top, the jquery.js and jquery-calendar.js files) . Is there a viable solution to getting his code working to get the calendar and time picker? Also, does the fact that his jquery.js file is running 1.1.2 make a difference. If my last message got posted, I apologize for double posting
[jQuery] Noob Question - How do you use the plugins created here in Dreamweaver?
I am new to the whole plugins thing. Can someone help me? I am looking to use the JQuery Carousel and want to know how to use these plugins. Please be descriptive if possible, or point me to a tutorial. Thanks all in advance, Aza
[jQuery] noob question
Somehow I don't get the concept of get() right. The following expression gives an error; $('p.fl').get(0).css('background', 'red'); Now what I'm trying to do here is select the first paragraph from all the paragraphs with a class of "fl". After that I'm just trying to get a visual id by making it red but it's more about grabbing the element really. There's probably a very good reason why this doesn't work but what I understand from documentation this should work? This ultimate goal is to hide a paragraph based on it's index. This index is gotten from a clicked link. So far I've got this, but it's stuck on the get() part. $('a.leesmeer').click(function() { var nmbr = $('a.leesmeer').index(this); $('p.fl').get(nmbr).hide(); $('div.case').get(nmbr).show(); return false; });
[jQuery] noob question: loading dynamic content with .load()
im kinda a noob with some of this jquery stuff. esp the ajax stuff so any help i can get here would be greatly appreciated. i am using this code to try to load new content into my content div. $("myContentDiv").load("myScript.php?var1=x&var2=y&var3=z") myScript.php generates my new content to load into my Div. there can be anywhere from 0 to 1000 rows of data returned. sometimes myScript doesnt load correctly. even if i add a callback, the callback runs but the data doesnt load. Is it best for me to have myScript.php generate all the html and then have it loaded into myDiv or is there a better way. thx for helping this noob.
[jQuery] Noob question about accessing element contents
Hi: I'm a noob, so please be kind. I am using jquery to parse some xml. I'm looking for the best practice to access an elements text contents. Let's say my xml looks like this: Hello world! Goodnight moon! I can get a wrapped set of the elements this way: $('items > item', xml) And I can get the text of element 1 this way: $('items > item:eq(1)', xml).text() But how do I get the contents once I am directly accessing the element instead of the jquery object? In other words I'd like to do something like this: $('items > item', xml)[1].text(), but since the element that’s returned from the array [] doesn’t support text() how do I get it’s contents? I know I can wrap it in a second $ call, as in $($('items > item', xml) [1]).text() but that seems less than ideal. Thanks!
[jQuery] Noob Question: Using Selectors after ajax load
I am sure this has been answered before, but I could not find it. I click on a link which loads a second page into a div using the load function $(document).ready( function() { $(".actions a").bind ("click", function () { $("#ajax_div").load($(this).attr("href")); return false; } ) $('#SampleCustDue, #SampleCustReq, #SampleVendorReq, #SampleVendorActual, #SampleVendorRec, #SampleCustShip, #SampleCustApprove, #SampleVendorApprove').datepicker(); }); The page that is being loaded has several text fields that I am using the date picker plugin for (#SampleCustDue etc...) The problem is that the selectors are not finding these fields after the page has been loaded in the #ajax_div. My guess is that the page needs to be re-indexed, but I cannot find a function to do that. My other attempt was to create a new $(document).ready() function in the page that was being loaded via ajax, but that never seemed to get called. Any ideas? Thanks in advance!
[jQuery] noob question: how to close current visible in this script
Ladies and Gentlemen, Here goes my complete noob question: I have this demo page: http://www.itchycloud.co.uk/panther/ in which I'm using this jquery script: $(document).ready(function(){ $("dd:not(:first)").hide(); $("dt a").click(function(){ $("dd:visible").slideUp("slow"); $(this).parent().next().slideDown("slow"); return false; }); }); which I found on sniplr: http://snipplr.com/view/2208/jquery-collapsible-sidebar-menu/ I would like to modify this script so that when the user clicks on the current active - displayed, open - then the appropriate will collapse/hide. I suppose it should be something like this in pseudo-code: if current.DT is the previous sibling of current visible DD then click function() will close DD; else click function() will open next sibling DD Basically, when there is a lot of content in a given DD I want the user to be able to click on the previous sibling DT A and it will close that DD. This will prevent a lot of scrolling with some pages on the planned website. TIA for your help. I am really looking forward to learning javascript and jquery, Adrian
[jQuery] Noob question: How to access a PHP variable and append it to the html?
I have a PHP array of data I want to be able to append to the html using jquery and ajax. I want to be able to add different elements of the array to different parts of the page. How can I go about doing this?
[jQuery] Noob Question - .add() not working in IE?
Hello group, I try to dynamically add some tags and content to an existing element (basically a toggle-link, that's only to be seen if JS is active and that slideToggles a div). Somehow my code doesn't work in IE, although it works fine in other browsers like Firefox or Safari: +++ JQuery: $(document).ready(function(){ // hide div on pageready: if( $("div.reduction-wrap") ){ $("div.reduction-wrap").hide(); // add toggle link with icon to headline with( $("#toggle-link") ){ children('img').append(''); append(' show'); html( ''+$("#toggle- link").html()+''); } // click on link toggles hidden div: $("#reduction-toggle").click( function() { $("div.reduction-wrap").slideToggle("normal", function(){ if( $("div.reduction-wrap").attr("style") == "display: none;") { $("#reduction-toggle").children("span").html("show"); $("#toggle-icon").attr({src:"images/pfeil-blau-r.gif", id: "toggle-icon", alt: ""}); } else { $("#reduction-toggle").children("span").html("hide"); $("#toggle-icon").attr({src:"images/pfeil-blau-u.gif", id: "toggle-icon", alt: ""}); } }); // make sure nothing happens with the link: this.blur(); return false; }); } }); HTML: Title content +++ What is wrong with that? IE will hide the div, but no link-markup is inserted to the html. Thanks for any hint or shove in the right direction... Tom
[jQuery] noob question - load function - dynamic content to slide in place
I'm new to jQuery and can't figure this one out. Instead of using an ajax get and innerHTML to load in external html, I can just use jQuery's load function: $(emptyDiv).load(externalHTMLFile); which I like! I would like to do is make better use of the graceful animations that jQuery has. I would prefer that the external HTML not show up so suddenly, but instead to slide or fade in place. It's not clear to me how to make that happen. I tried "chaining", but by the time the content is loaded, the chained animation doesn't really do the trick: $emptyDiv).load(externalHTMLFile, function() {$emptyDiv.slideDown('slow');}); If you know of answer, please share. Thanks for any help. Tony