JQuery :: Can't Understand Code - First Each() Function Stops At "three"?
Sep 7, 2011
I don't really undertand what do $("#" + this) and $("#" + i) mean. What's the meaning of "#"? I don't understand too why the first each() function stops at "three". I think it should be return (this == "three"); instead of return (this != "three");.
success(data, textStatus, jqXHR)Function, Array A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object.
'success': function(html){ jQuery("#quote-of-the-day").html(html) } success: function(data) { var out = "<ol>"; $(data).each(function(){ out+="<li>"+this.title+"</li>"; });
The above 2 ways of defining the success call back confused me.
1) According to definition, it should take 3 parameters, why here it only takes 1 parameter? 2) Why the name of parameter passed into function() can be different? Does this name matter?
I have a table with a SAVE button on each row (id=SaveBD)...but I also have aSAVE ALL button at the top. It works pretty good except the .each function seems torandomly stop near the end ofthe row countand not save all the rows.that would cause the rows to stop saving?
iam either being really dumb or something is way wrong with the code. i am trying to create a fade in / fade out effect. i know there are tons of scripts out there that do this, but i like to do it myself. my script is only working in firefox at the mo (when it works il cater for other browsers). basically i can get the fade out part to work, but when i want to fade back in it does nothing. now logically id of thought that fading in would be the same as fade out but reversed.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
I paid for some to create a slideshow, and it works fine in the orginial html document but when i copy and paste the code into my html document the scroller to the left of the image stops moving up and downI put the working file at thisthe guy i paid to do work refuses to help even those i advertised the price in my ad and he wanted me to give to pay him more to tell which code to change
I'm trying to create a demo to display a new way of showing our data.I thought I remembered this being pretty simple but I'm hitting a snag. The table, the mouse over, and the check row by clicking on the row all work separately but when the check row by clicking function is on, seen in the first row, the checkbox stops working.
I try to define a javascript class and define a event handler for it. There is a member and a memberFunction and a event in the Class body. Then I created a object (obj) of Class and defined a event handler like this:
obj.event = function() { alert('event'); }
When I call the function: obj.memberFunction(); the event handler was fired and alert a message ('event'). But when I try to use a button to fire the event, it doesn't work. It seems we have lost the member function callEvent, it is a undefined value, the same as this.event member.
A very brief background before my question - I run a forum where it has recently been reported that the signature used by one of the members includes a URL which is reported by Kaspersky antivirus to contain some malware, specifically "Trojan-Downloader.JS.Remora.w" (a trojan about which I can find very little information). Well, I didn't have anything better to do yesterday so I thought I'd take a deeper look into this and, while taking some precautions, did indeed find some obfuscated JavaScript on the page in question. I should state at this stage that I'm not a programmer but after a bit of Googling discovered that I could de-obfuscate (is that a word?) the code using an online script which turned it into something fairly readable. However, as I say I have virtually no programming knowledge and what the code does, or attempts to do, is completely beyond me, although from what I read yesterday I believe that the JavaScript functions uncovered are probably designed to create another bunch of JS code which actually does the damage.
Having come so far I'm now really intrigued to find out what the code does but I don't have the knowledge to go that one final step. My question here is simply is this an appropriate place to post the code and ask if anyone can explain it? I'm aware that as this looks like something undesirable there may be good reasons for not posting it and if that's the case does anyone know where might be a more appropriate forum? Alternatively, if anyone wants to take a crack at it individually please let me know and I'll be happy to send through what I've come up with.
I am having a strange problem with a javascript function that does not return the value but returns the code inside the function. My best guess is that I am incorrectly calling the function hasLandedOn()and jquery is interpeting it. Why is this happening? I highlighted the parts in red.-Tom ReeseThe following is returned NOT the variable imageName.
function hasLandedOn(){ var selectorLoc = $("#selector").offset(); var imageName = "";
I am VERY NEW to javascript programming as I am to web development. I am pretty decent with VB.Net though. My question is, what are the different ways to call a JavaScript Function either from within XHTML Markup code or from a VB.Net Code-Behind file?
I have some links on my page with ajax calls, and the callback animates the links. My problem is, if I quickly click on two of them, the first one will begin to animate (ajax will complete successfully), and then when I click on the second one, the first one will stop animating, and only the second one will finish.
// document.ready /* behavior for add to cart button */ $('a.item-addCart').live('click', function() { addToCart($(this)); } ); function addToCart(button){ /* parse data from button clicked, corresponding quantity box, and hidden price field */ $item_id = button.attr('id').split('-')[2]; $item_qty = $('input#item-addCartQuantity-'+$item_id).val(); $item_price = $('input#item-addCartPrice-'+$item_id).val(); /* set loading notification */ $('div#item-addCartActions-'+$item_id).html('<img src="/images/ajax-loader.gif" />'); /* AJAX */ $('div#item-addCartActions-'+$item_id).load( 'shopping_cart/add', {item_id: $item_id, item_qty: $item_qty, item_price: $item_price}, function(responseText){ /* show response text */ $('div#item-addCartActions-'+$item_id).html(responseText); /* pause on response text for 2 seconds */ $('div#item-addCartActions-'+$item_id).animate({opacity: 1.0}, 2000, function(){ /* fade out response text */ $('div#item-addCartActions-'+$item_id).animate({opacity: 0}, 'slow', function(){ /* show link to shopping cart */ $('div#item-addCartActions-'+$item_id).html('<a href="shopping_cart">Item in cart</a>').css('opacity', 1); })});});}
Ok so this is weird. I implimented jquery to try and get some ajax funtionality working and it not olnly doesn't work, it stops the rest of my normal js from running at all.
[Code]...
EVERYTHING stops working. All my DOM events don't fire and none of my regular JS works. Anyone know how to get jquery code to work with or without normal JS code?
WhenIrun the below code above the init code for jQuery plugins it stops them working. Im just trying to run the code after the DOM has loaded, is there a better way? <script type="text/javascript">$(document).ready(function() {
// The gallery is hidden so need to unhide it. document.getElementById('verticalCarousel').style.visibility='visible' }) </script>
I'm starting with jQuery and all I want is like jCarousel, but I want that when mouse is over image, the entire carousel freezes (until mouse over). So, my first idea is to create something like this: <div class="photo" style="width: 256px; background-color: #8d99a2;" align="center"> <img class="photo_img" id="photo1" src="fotos/lookbook1.jpg"></div> <div class="photo" style="width: 256px; background-color: #8d99a2;" align="center"> <img class="photo_img" id="photo2" src="fotos/lookbook/2.jpg"></div> <div class="photo" style="width: 256px; background-color: #8d99a2;" align="center"> <img class="photo_img" id="photo3" src="fotos/lookbook/3.jpg"></div>
And Then, jQuery like this: $(".photo").animate({ "right": "+=9999999999" },{ duration: 200000000000, easing: 'linear' }); $(document).ready(function (){ $('.photo_img').mouseover(function(){ $('.photo').stop(); });});
The logic is that: -> a list of images that go to right eternally, (like jCarousel in infinite mode), but when mouse is over, everything stops. (JCarousel waits until the "next()" function is complete), and when mouse is out, everything moves starting from the point that paused.
We have a page that allows a user to load a form over ajax using jQuery 1.3.2. The form contains a simple table layout, some input boxes, tinymce and the initialize for a jQueryUI dialog. On first load everything works fine. If the user loads the same form again, without refreshing the browser window, TinyMCE no longer shows content, can’t be clicked inside of and the dialog no longer updates it’s content and a few other bits of js stop firing.
Now I thought this was an issue with the page and ajax, but we have another page that uses draggable elements and has a very simple form of 1 input and a submit. If you submit the form and get returned the same page by our validation the same thing happens as with tinymce, you can no longer click inside it.
In ie7 things dont stop responding so much but the browser slows down and almost stops responding.
I've implemented the jqueryPreloader I found here. It work fine except for two pages in wich the script stops without end and so the page is not visible...the web site where I added the scriptinfo and contact page where the script doesn't workI looked to the firebug console but there isn't any apparent error... but the script loads the screen-wide div (.QOverlay) with #fff background and ends without load the loading bar and without fading out the .QOverlay div
I'm trying to use the cascade function from the below link. If I try it as it is there, it works, but if I change the jquery reference to the one I'm using (1.7.1) it stops working... is there a diferent way to use that ajax call or am I missing anything?
I am using the jquery sliding panel, and have embeded a music player. Everytime I minimize the sliding panel, the music player stops. Here is a link to my example, if you click on radio on the left: Vertical Sliding Info Panel With jQuery