How do you use variables inside of click functions.
I have some vars I wanna persist beyond the click function. I declared them outside. I'm not much of a java scriptie. But as I understand you use var for local vars and you don't use var for globals. I guess these are globals. $(document).ready(function() { piecesUsed = []; piecesAvailable = ['NSW','WA','Queensland','Victoria','Tasmania','NZ','SA', 'NT']; currentPiece = ''; $('#ask').click( function() { if (currentPiece == '') { i = Math.floor(Math.random()
Ajax Textarea process
Hello everybody I have a textarea that can take a lot of information, for example hundreds of names seperated by new line. When the form is posted, a PHP-script takes over and processes these names. Since there can be hundreds, sometimes thousands names in the form, this might cause the webserver to timeout since the php-script is taking too much time. I would like to simplify things by letting jquery send one or perhaps five lines on the textarea values to the php-script at a time, ajax-mode. This
jQuery cycle
Thought I might gives this a go instead of the usual flash. Installation went fine, but the images runs a bit inconsistently? Images are 30-50kb which shouldn't be a problem. Any thoughts? http://d1000841.comendohosting.com - Thanks
Background Image scrolling?
I was wondering if its possible (or prefferably if anyone has heard of a plugin that does this) to use jquery to slideshow a repeated image across the width of a webpage. IE to take a 50x50 background image that is repeat-x and have the looped image look like its scrolling from left to right at variable speeds?
slider move on hover
Hi, I'm using a slightly changed version of "easySlider" for my site to create a carousel. I'm trying to change it so that the slider will "slide" on hover instead of mouse click. when looking on jquery hover I see one action for "mouseIn" and one for "mouseOut". how can I create a repetitive action that will occur as long as the mouse is over the button ?
Image replacement firing in Chrome...
Hello, my understanding is that one of the great benefits of $(document).ready() is that it will execute code once the DOM is ready, yet prior to content being loaded. For my example, with what I'm observing in Chrome (I'm on a MAC), I'd like to replace a default image with a different image, without seeing jQuery do the work. However, in Chrome, I see the original image for a brief instant before the jQuery replacement pops in. Why the flicker of the original image? Perhaps I'm not understanding
Nested event listeners?
I'm new to jQuery, so I'm hoping y'all can give me some guidance here. I've narrowed down my problem, and now I just need someone to show me the better way. Apparently in jQuery it's a bad idea to have nested event listeners. It makes sense to me: Say I have a button that toggles between two states. In the first state, another button is activated and can be clicked (another event listener there). In the second state, that button cannot be clicked. But when I implement this, here's the result:
Jquery help. I am using .submit and .post stuff.
Hi, I am using the .submit and .post to process a form. It's a normal form. This form appears after a person clicks a button. So the form isn't showed first but after a person clicks on a button it will fade in the form. here is the code : <script type=\"text/javascript\"> $(document).ready(function(){ $('#interested_data$nu').submit(function() { $.post('/market/interested.php',$('#interested_data$nu').serialize()); var html='<a>Message:You suceeded on sending the message.</a>'; $('#interested_background$nu').html(html);
How do I extract a partial attribute value?
Hi, I'm new to jquery. I like to ask about how do I get a partial attribute value? My code: <a href="#" id="id-1">Link 1</a> <a href="#" id="id-2">Link 2</a> <a href="#" id="id-3">Link 3</a> I like to extract link attribute value in id-x, so I'll get numeric 1 or 2 or 3. How do I do this? Thanks before.
problem with sortable based on jQueryUi
Hello @ all, I am having a problem finding the bug which is coming up with one script. I get following error in FireBug: uncaught exception: Syntax error, unrecognized expression: ) The problem is caused somehow inside my base.js, guessing the sortable function does not want to work with my jQuery version. Please have a look at following demo: http://dev.evilmile.de/CommandCP/ Line 656 at base.js: I have used the inettuts script which basically clones iGoogles interface. The script gives me the possibility
Pass a DIV ID to a self-defined function in JQuery
Hi all, I am writing a simple html in which when the user moves his mouse over a particular DIV, a message box will pop up. Part of the code is as follows: <DIV id="1">Hide them</DIV> <p>Hiya</p> <p>Such interesting text, eh?</p> </td></tr></table> <script> $("#1").mouseover(function () { $("p").hide("slow"); }) $("#1").mouseout(function () { $("p").show("slow"); }) </script>I want to make the code re-useable, but dont know how to modify it. Let's think the
Select Syntax
I always have a terrible time getting jquery syntax correct. I have a structure like this: <div class="tmenu"> <ul> <li>Line One</li> <li>Line two</li> </ul> </div> I'm trying to select the second line like this: $j('.tmenu li:eq(2)').dosomething(); But since it's not working, I have obviously done something wrong. I can select the second line by assigning it to a class. But i don't understand why the syntax above doesn't work.
how to call asp.net's TextBox control's onFocus() method in JQuery?
Hi, I want to create a registration form in which when user clicks on a textbox feild, then a helper text appears. Like the one already created on the following page- https://accounts.zoho.com/register?servicename=ZohoDiscussions&serviceurl=http://forum.jquery.com Below is my not working code, can any one figure out what I'm doing wrong in this? <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"> $(function(){ $("TextBox") .focus(function
Need help parsing some Atom feed
I have trouble doing the parsing in a correct way, probably. Example of a page I'm trying to parse: http://to.uri.st/search.atom?c=52.5,-0.25 I did it the following way: $(response).find("entry").each(function(){ hName = $(this).find("title").text(); hpoint = $(this).find("georss:point").text(); } ); Now for some reason I do get the hName but I don't get any of the hpoint's. What can be a reason for that? They seem to be on a same hierarchy level. Thanks in advance.
I think this is a bind thing?
Hi folks, I'm having trouble understanding how to make the second select box <select name="sp" id="sp"> box work just after it's been created. Please see the script in action here: http://spainpropertymart.com/dev/search_jquery/search.php An alert should fire after changing the Provinces select box... I've read some of the bind stuff that's recommended, but I'm not getting it!
What type of coding or programming i need to know for jquery ?
Do i need to know javascript, php, ajax ? or does jquery is a self language on its own ?
browser GUI tool to draw HTML elements + CSS + JS + PHP
Hi, I am new here. Please help Just want to know where can I get an framework or a GUI Tool web browser based able to draw and configure HTML elements, set their CSS themes, make JS routines etc... I'm sure this one was already done somewhere I dont know. Take a look in the screenshot of a GUI I'm developing
IE won't let a tooltip script work properly.
I just spent several hours figuring out how to make a mouseover script put up a larger image when the cursor moved over a smaller image. I learned how to do it all, using Firefox, Safari, Chrome, Opera and you name it. Then I checked it in IE8 and it would not work. It somewhat works on line, but when downloaded, all the others work it, but IE just fails. Of course, I should have thought of that to begin with...but hope springs eternal... I got it at this site: It seems a wonderfully simple piece
toggle fade in/fade out animate
Hi I would like to have the content container slide out as a dropdown fade effect. I currently have this but i can't get my head around to using the fade //Hide (Collapse) the toggle containers on load $(".toggle_container").hide(); //Switch the "Open" and "Close" state per click $("h2.trigger").toggle(function(){ $(this).addClass("active"); }, function () { $(this).removeClass("active"); }); //Slide up and down on click $("h2.trigger").click(function(){
JQuery-Latest.js file size
The JQuery-Latest.js file size is about 160K. All I need is the .ready function. Is there a smaller .js file that can be included in my html header? Respectfully, Lance
Sigh. I feel like a chimp. (basic jquery get question)
OK, so I'm hacking on a bit of jquery I found on the internet, and I've actually figured some stuff out. I can get jquery to change variables and then send them to the server on the fly, which is cool, and I think I'm starting to figure it all out. So in this case, I'm trying to figure out how to set some variables dynamically at load time. I figured I'd store them in a plaintext file, while I'm learning, and I'd pull them in at load time using .get. Seems simple enough. Well, turns out I must
Jquery slider animation performance issue in firefox.. plz help..
Im using Jquery and LoopSlider http://nathansearles.com/loopedslider/ http://www.ezzal.com/wp-content/themes/ezzal/includes/js/loopedSlider.js And I used sliders in my homepage of : http://www.ezzal.com (in section : spotlight) It works very smoother in Chrome and IE.. But its moving slower or maybe flickering a bit..in FireFox. I use Firefox 3.6 Its working very smoother in IE6 too ! Any tips or ideas to solve this ? Thank you.
Does jquery animations rely on a global frame-rate mechanism
Hello, I immensely enjoy jquery but I always have troubles when designing complex animation scenarios that include several elements with precise timing. I wander does jquery use 1 global frame-rate (as flash) and calls 1 step of each active animation when enters a frame or it uses per-animation frame-rate which is not synchronised with the other animations ?
Find the name and create a list. How?
Hello, I'm starting to learn javascript and jquery and I would do something like this: 1. The script finds all the headings in html (<h1></h1>). 2. Creates a list of titles of these headers. 3. The list has a specific css and the maximum length of text. 4. Each name from the list has (<a href="">name</a>) is a link to the title. $(document).ready(function() { $('h1'); $('.left li').addClass('button'); }); ...? please help...
Cant figure out how to get slide down to work.
I want some content to slide out down when the title of a section is clicked. Here is what I have, and I cant figure out why it is not working. <div class="clearfix section_block"> <h2 id="section_headline"><a id="clickme" href="#"> Message Board</a> </h2> <div id="container1">
jQuery always render <br> instead of <br/>
Hi, is there a way, switch, option etc. to let jQuery create <br/> instead of <br>? The following code will always create <br>: $('<div class="partner-item-data-short"><strong>' + data.partner[x].name1 + '</strong><br />' + (data.partner[x].zip.length ? data.partner[x].zip + ' ' + data.partner[x].city + '<br />' : '') + '</div>' ).appendTo(pi); Anyone got into this too? I would like to got valid xhtml 1.1 code :-) tia
Dynamically find and replace £ with £ within a table
Hi all, I'm pretty new to Jquery and have a question. I'm loading html tables using tabs. One of the tables has £ signs within the cells. These aren't displayed properly and I wish to replace them with £ Any ideas? hes516
Need a script to Hide an Html element based on the the number in another html element
Hello I am working on a e-commerce site and I need to hide the checkout link (<a>) if the value of of the element (<td>) holding the amount due ="$0.00". <tr> <td colspan="4" class="impact subtotal">Outstanding:</td> this amount is generated from the shopping cart database <td>$0.00</td> </tr> </table> </td> </tr> </table> this is the link that needs to be hidden if the amount of the above element is $0.00 <a class="impact purchase_btn" href="#">PURCHASE ORDER</a> I am new to Jquery so if someone
Removing sortable tabs
Hi It have a problem with the sortable tabs. When i try deleting one of them after changing their position, this is another which is removed. I have read that tabs don't check the new DOM positions. Is there a way to correct it ? thx :)
if there's siblings and parents, why aren't there uncles and cousins?
I'm sometimes having layouts like this: <div> <div> <div>I click here</div> </div> <div> and something happens here, e.g. slideToggle </div> </div> I have to write $(this).parent().siblings().slideToggle("fast"); I'd love to write: $(this).uncles().slideToggle("fast"); To be correct in a gender way there maybe should be an aunt as well. For the following cousins would be great: <div> <div> <div>I click here</div> </div>
Does anyone know what plugins I might need to create a photo gallery like the ones in Krop's portfolio's?
Does anyone know any jquery plugins that might achieve a gallery like this? http://www.mullerphoto.com/portfolio/13508/
Alert displaying [object Object]
Hello everyone I am trying to alert the ID of a particular menu that I have clicked on and I am getting object,object. Instead of the name of the ID. Any help would be appreciated. function menuEvents() { $('#test').click(function() { test( $('#testSection')) }); } function test(menuElement) { if( menuElement.css('display') == "none" ) { menuElement.slideDown(1000, expandComplete); alert("Menu Element: " + menuElement); return false; } else { menuElement.slideUp();
Want to save a few lines of code but dont know how to do it
Hi all, I am using JQuery 1.42 to write a simple popup table to show some information to users when they move the mouse over a string of sentence. Here is the code I copied from a web site: <script> $(document).ready(function(){ $("#link").mouseover(function(){ $("#popup_menu").show(); return false; }); $("#popup_menu").mouseout(function(){ $(this).hide(); return false; }); }); </script><a
IE not displaying first line of returned data from AJAX call
Hi there, I'm having a little problem with a jQuery/JS script I just wrote in IE7/8. The problem is the first 2 lines of the returned data are not being displayed (w or wo styling) but only in IE. The strange thing is though if I alert the returned data it's there. the code can be found at http://www.goptown.com/ajax2.html Any help would be greatly appreciated. -Stefan
changing DIV background by pressing link
hello everyone, I have function: function blabla(){ $("#div").css("background-image", "url(img/new.png)"); } This function changing div background which ID is div. And: how to do that div background will change only on pressing link (not after release mouse button)? EDIT: okay i solved this problem: http://api.jquery.com/mousedown/ but i have another question, how to make background repeat repeat-x by using .css jQuery function?
Resize all object of a div
it is possible to resize all object of div ( example img , text ... ) with one command only when te all object download I'use for img this code $(document).ready(function (){ $(img).each(function(i) { var rap=($(window).height()/600); if (($(window).height()<=600)) {rap=1} if (($(this).width()>0)&& ($(this).height()>0)) { var w = $(this).width()*rap var h = $(this).height()+rap $(this).css({ height: h, width: w }); } but is image of div not download this image no view TK
function evaluation
I'm trying to understand when bound functions are evaluated. My code below shows "You see 5" on every link while I want it to show the number associated with the link. 5 is of course the value of i after the loop terminates. How can I change my click function so it shows what I want?? Thanks for the help! <html> <head> <title>JQ function evaluation primer</title> <script type="text/javascript" src="jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function()
JQUERY ON A MAC
Hi Been trying to find how to set up jquery on a mac... its like trying to find a needle in a haystack! what exactly is it that u need to run jquery - ie do i need to install Java? a framwork if so what do i need to do? Any help would be great!!!
avoiding repetitive code
hey guys, i have following code, that i am sure can be done in 1 single function, which will ease extending it in future. $('#import_active').click(function() { $('#error_notice').hide('slow'); $('#upload_storno').hide(); $('#upload_new').hide(); $('#upload_active').show('slow'); return false; }); $('#import_storno').click(function() { $('#error_notice').hide('slow'); $('#upload_active').hide(); $('#upload_new').hide();
Accessing xml data
I've created an xml file, called "pages.xml" that contains the size and position of various windows that I want to open at various times: pages.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <popups> <sw1"> <height> 300 </height> <width> 400 </width> <top> 50 </top> <left> 30 </left> </sw1> <sw2"> <height> 600 </height> <width> 500 </width> <top> 80 </top> <left> 40 </left> </sw2> <sw3> <height> 700 </height> <width> 400
Next Page