Preventing an input from losing focus?
Basically I want to prevent a user from moving to another field if the current one is invalid (non-numeric). I've tried a few things that I though would do the job, I've also tried using the change event with the last line (resetting the focus to the current element) but no dice. Can anyone give me a hand? jQuery('.setupprice, .monthlyprice, .quantity','#config_dialog').live('focusout',function(e) { var val = parseFloat(jQuery(this).val()); if(isNaN(val)) { jQuery(this).css('background-color','red').css('color','white');
setting background image to another div's dynamically generated image
I have a div set up like this <div id='y' style='background-image: url(./randomcolor.php?ibase=<?php echo $entity->name; ?>) .... I am having an issue with setting the background-image of a another div #x to the background image of #y. Correct me if I am wrong but I think you would do this in a simple case by saying $('#x').css('background-image',$('#y').css('background-image')); So when it does it, it is getting the URL of the generator (I logged it. what is actually being passed is http://blabla/randomcolor.php?ibase=xyz
How do I create an endless animation?
I have seen this question asked several times while searching the internet and all the answers seem to be workarounds. Is there a way to do an animation forever with jQuery? All I get are recursion errors; not on my code but on jQuery. Line 580 of jquery-1.4.2.js So this is what I am doing. I have a complex function for smooth extremely slow animation (clouds in the sky) my function moves an object one pixel at a time. If I take out all recursion, the clouds move one pixel with no error. If I leave
site exit popups
How can I make jQuery do something when a user leaves the site, such as pop up a message with a link? I've seen pages like that. Yes, I know they're annoying, but I'll be good - just a quick disappearing reminder link - not those awful things you can't get rid of What the heck is this marked as spam for? The spambot must be smoking dope. Is it the code in my tagline? --- Jim Mooney If only one man knows what is " + (1==1) + ", it is still " + (1==1)
html() Not Registering New Elements In the DOM
This may be a repeat post, but I can't seem to find the answer in these forums. Here is the question: I have a div with id "someDiv". I am obtaining an HTML string via XHR and intend to insert it in the DIV. I use .html(theHtmlString) and it renders just fine. But the newly inserted elements are not in the DOM - either by name or id. How do I register them in jQuery?
Displaying a child whilst hiding a parent ?
Greetings all I have a div (representing a form) with a number of images positioned absolutely within it. The images represent buttons and what I'd like to do is click on one of the images/buttons and the whole form to fade out with the exception of the selected button which merely changes it's opacity from 1 to 0.5 (to remind the user it was clicked). Here's the code I'm using: $(this).parent().fadeOut("fast"); $(this).stop().css("opacity", 0.5).fadeIn("fast"); However, despite referencing
How do you call a function from another frame?
This seems straightforward, but I can't talk Google into telling me the answer. What's the jquery equivalent of this: top.frames['MainFrame'].DoSomething() I tried $(document,window.top.MainFrame.document).DoSomething() since similar syntax works for referencing elements, but no such luck with a function.
Ad rotator not working
A previous web developer provided this ad rotator script for our site. var image_count; var current_image=0; var image_count_left; var current_image_left=0; $(document).ready(function(){ image_count = $("#banner div").hide().size(); image_count_left = $("#banner2 div").hide().size(); $("#banner div:eq("+current_image+")").show(); setInterval(feature_rotate,13000); //time in milliseconds $("#banner2 div:eq("+current_image_left+")").show(); setInterval(feature_rotate2,10000); //time in
Polling Database using jQuery/Ajax
Hi guys, I am trying to do the following using AJAX using the jQuery library, can anyone suggest how I do this? Poll mysql database (eg SELECT id, field1 FROM table WHERE field1 = 'xyz' LIMIT 1) if no query returned do nothing if query is returned display jQuery UI dialog modal I've got 'chunks' of this working.. it is just the joining it all together.. (jQuery doesnt wanna know lol) I've got the initial bit (poll db, but haven't got it to return the value to a variable) Also, the jQuery modals
Dinamically adding form field to a form
Hi all, I know that the subject of this message is very common, but what I would get is this: in my database I have this table CREATE TABLE parameters ( parameters_id serial, object_id INTEGER NOT NULL DEFAULT 0, label VARCHAR (50) NOT NULL DEFAULT '', value VARCHAR (50) NOT NULL DEFAULT '' ); object_id is related to another table with value: car INSERT INTO parameters (1, 'color', 'red'); INSERT INTO parameters (1, 'wheels', '5'); INSERT INTO parameters (1, 'speed', 'fast'); I need to create
appentTo and Chain
Hi... I recently found in this url http://blog.pengoworks.com/index.cfm/2007/10/26/jQuery-Understanding-the-chain the following example: $("<strong>append me!</strong>").appendTo("p").appendTo("div"); The example says that <strong>append me!</strong> would be appended to "p" and "div" elements, but it does not work...it always append only to the last, in this case the "div" I appreciate your help...
How to add class?
Hello, I am new in JQuery. How can i add class to "UK" using JQuery method? I am reach at $('.folder-open-last > span').addClass("active1"); <ul> <li id="17" class="folder-open-last"> <img border="0" src="js/jquery/plugins/simpleTree/images/spacer.gif" class="trigger" style="float: left;"> <span class="text">Europe</span> <ul style="display: block;"> <li class="line"> </li> <li id="19" class="folder-open"> <img border="0"
Add text into a <span>
Hi guys, I have this script who will set a text to an existing or newly created <span>. When I executed the script, I can see ths <span> element to the source but the text never appear. Here is the last version of this script (the alert box is displayed but the "_message" is never dispalyed to the page): var _message = response[inputId]; var $field = $(jqn('#'+inputId)); var $span = $(jqn('#'+inputId+'.errors')); /* If the span isn't already in this page and if we have a * message
How to avoid repeat event binding?
I have developed a plugin for mutual selection on a list of elements. It works fine if I make those element into mutual list only once. like $("appropriateSelector").toMutualSelect(); that plugin will add click event handler to each element and they remember the whole list by enclosure. If I add new elements to that list. and do $("appropriateSelector").toMutualSelect(); again. new elements will behave as expected but old ones will have problems. each old element will have the same handler bind multiple
Autocomplete from SQL Source
Im developing a small website using VBScript ASP, and i would like to have a field which uses autocomplete, and the values are generated from a database. For example, i have a table called CallVendors. So i want to: SELECT Vendor FROM CallVendors order by Vendor. These should populate the autocomplete field. Is this possible?
Javascript stops working after ajax submit
I've got a page that loads a php file inside a div using load(). Inside the ajax-loaded page there's a button which will load a second php file in the same div. This works fine and on the second div a form will be loaded. Inside this form I've got an info button (after the e-mail address field). Clicking this button will open a dialog, using the UI dialog. So far so good, everything works fine. Even after clicking back in the form page and clicking the button on the index page. The problem appears
Execute jQuery function from javascript
Please excuse my English and my ignorance in jquery I have a function javascript which validate information. function validateLogin() { if ( document.getElementById("login").value == "fail" ) .... i need show a modal window to login .... } } I trying use jQuery, but.... i don't know how call the jQuery function....for example.... $(document).ready(function() { $('#div_login').click(function(e) { alert("HELLO, Log in please!!!!"); }); }); How i can call the
how can catch Asp TextBox with jquery when the Control has not nay ID or Name ?
hello friends, I am try to catch the asp elements that are used but they have not any Id or Name, But as you know thos elements in run mode change to HTML DOM, please help me.
jquery 1.4.2 tabs problem
I'm new to this forum and jquery, recently i've updated new version jquery 1.4.2 after that, initially while loading the web page my first and default tab showing the last tab content, once we clicked on any tab then the problem solved automatically, again if we load the page again the same problem ocurrs. following is the code i used $('.main).tabs(); <ul> <li><a href="#tab1">Title Page</a></li> <li><a href="#tab2">Manuscript</a></li> <li><a href="#tab3">Figures and Tabels</a></li> </ul> <div class="main">
Flash animation not showing in htm file, which is opened using load() method.
Hi, jquery code ------------------------- $(document).ready(function(){ $("body").append("<div id='qsDiv'><div class='ui-overlay'><div class='ui-widget-overlay'></div><div id='qsShadow' class='ui-widget-shadow ui-corner-all'></div></div><div id='qsContent' class='ui-widget ui-widget-content ui-corner-all'></div></div>"); $("#qsDiv").hide(); var bwidth = $("body").width(); var poswidth = (bwidh-832)/2; $("#qsShadow").css({left: poswidth + "px"}); $("#qsContent").css({left: poswidth + "px"}); });
Ajax and SSL
Hi guys I have this really weird problem... i have a simple page <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> <script type="text/javascript" src="/scripts/my/jquery.js"></script> <script type="text/javascript"> function x(){ $.get("https://localhost:9443/test1.php", function(data){ alert(data); }); } </script> </head> <body> <a id="tester" onclick="x(); return false;">test</a> </body> </html> So all this does is shows a "test"
Can't figure out this error!
I'm trying to make something where a user selects an option from a drop down menu. When an option is selected, another drop down menu appears with a new set of options (based on/related to what the first drop down selection was). Then after selecting from the second drop down menu, a third one appears (again, contingent on what was selected in the one prior to that). This continues down the line until there's no more options. All drop downs are populated from MySQL relational database tables.
Jquery slider interacting with text box
I am developing a vertical jquery slider. I am able to fetch the value of slider in a text box. I want to move the slider by typing in the values into the text box. any suggestion. Below is my code <script src="js/jquery-1.4.2.min.js" type="text/javascript"></script> <script src="js/jquery-ui.min.js"></script> <link href="css/jquery-ui.css" rel="stylesheet" type="text/css"/> </head> <body style="margin:300px;"> <form name="tvfinder-pricerange"> <input type="text"
how to replace $.livequery with $.delegate or $.live
I've used nice livequery plugin for many things, not just for binding events. Now when jquery1.4.2 is out it seems like it is time to replace $.livequery() with new .delegate() or even .live(), but browser events like (ready) does not work. Am I using the incorrect event (with delegate)? For example I am using livequery: $('ul.fileList li').livequery(function(){ var oi =$(this); // DOM manipulation, appending menus and attaching plugins and so
.each() update only first tag
Dear all, I have a problem with the iterator .each(). The goal of my code is to load the results from a previous vote round and displays it near the current votes. I inserted div tags with a specific id and iterate on it. In the .each() iterator I call a php function which search previous votes in database. The result of my code is that only the first div tag is updated and the following are one by one when I perform a refresh on the page... The html code is the following : <td class="zoneVote" width='14%'
Multiple bindings on one site slow down performance?
On our website we wanna bind a click (or maybe mouseover)-event on every user-image. The click on the image should open a layer with further information about the user. Now i look for a best practice way to solve this (focus on performance), because there could be a lot of user-images on one side. I think, if i bind the event on a class like this jQuery('.myclass').bind('click', function( makerequest; openlayer; )) that could slow down the site, because i read, that "The class selector
Re-initializing rules for ajax response
First off, sorry if Im confusing terms. Im a newb. Anyway, I have a simple UI with a button which initiates an ajax call to retrieve some html. The response gets dropped in the empty div. Since I am using plugins that I initialize in the document.ready function, the html that comes back from my ajax call never gets those rules applied. This seems to be a fairly common issue with plugins I am using. Any thoughts on how to solution? (I know "solution" is a noun and not a verb but for some reason
How do i use a var in my ajax?
I'm sure this is a somewhat stupid question, but I'm trying to get this code to work: var teamName = $(this).attr('id'); $.getJSON('json/team.json', function(data) { $("#dialog").html('<h3>' + data.teamName['name'] + '</h3>'); }); the var sets fine (gets the id from a button), but I want to be able to use it to get the JSON data so the data retrieved depends on what button is pressed. Any ideas? It's the bit in red thats being a pain. Thanks in advance.
Select all inputs below form
I have structure like below (inputs are not direct childs for form1): <form id="form1"> <div> <div> .... some other tags, more nested <input ...> <input ...> ... <input ...> </div> <input...> .... </form> how to select all inputs that are "below" form1 (direct or no direct childs) ? $('#form1 ..... ') ???
Fadein does not remain displayed after asp:Button OnClick event fired
Page has (Telerik) RadScriptManager and a RadWindowManager for separate functionality. I have added a div to get a jQuery fade-in effect. Inside div is a user control MyUploader with ListBox for adding files and buttons for adding, removing and uploading (POST'ing) to UploadPost.aspx. When clicking buttons, the fade-in disappears, but I want it to remain on screen when adding and removing. The "Add" and "Remove" asp:Button's have OnClick handlers in the code-behind. I surrounded MyUploader control
whizzywig gives error when loading via ajax call
hi , i would like to ask someone why i cant load a page that uses whizzywig (from www.unverse.com) as an rte editor via $.ajax , it gives errors while if a run the page normally without jquery ajax call it works ok ?? thanx in advance joseluis
Accordion conflict in Safari
I am having this strange issue. The page is here: http://dev.pb-webhost.com/lp/faq You'll notice the blue accordion on the left and then in the center are the FAQ's, which is also an accordion. They both work perfectly in IE and FF. But in Safari, the FAQ accordion does not work. Does anyone have any idea why just Safari is not working?
what ever became of the "select by style" patch?
Here's a link if you don't know what I'm referring to: http://dev.jquery.com/ticket/312 I'm trying to selectively (har har puns) run a font replacement method on elements that are assigned a particular font-family in css. The only not-painful way I see of doing this the way I want it to work is using this [&property=value] style selector. Will this patch even work with current builds of the jQuery? If so, please help me merge this as I'm SVN-retarded (I use Mercurial). Many thanks in advance!!!!
Filtering content with jQuery
Is there any way to filter content by multiple parameters using jQuery Something like in this site http://css-tricks.com/examples/FilteringBlocks/ but in my case I need to filter content using 3 different parameters. Price, Size and Location. Thanks in advance. Krystian
how to use each and change at the same time
<html> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="structure/style.css" /> <link rel="stylesheet" type="text/css" href="structure/calendar.css" /> <link rel="stylesheet" href="http://graphpaperpress.com/demo/wp-content/themes/modularity-lite/library/styles/screen.css" type="text/css" media="screen, projection" /> <link rel="stylesheet" href="http://graphpaperpress.com/demo/wp-content/themes/modularity-lite/library/styles/print.css"
Shift tab and drop down menus
I created a global navigation menu with drop downs. I tinkered with it to allow keyboard users to access the menu. It's tedious for the user, but it works. However, if the user uses Shift+ tab to tab backwards to the previous top menu list item, the drop down menus persist instead of "disappearing". The test site can be seen here: http://checkoutacollege.com:8080/. Can anyone tell me why the menus persist and how I address this?
Sending value with .submit()
Hello everyone, This is probably really simple, but I'm at a wall. I have a form with two submit buttons. One will save progress (which I do with a .post and no page reload) and the other finalizes the form (which I want to do a page refresh). I have a jquery dialog pop up for the finalize asking if the user is sure, and when they click "yes" I want to do a form.submit(), but I need to pass a value of "submit=Finalize" so my PHP script reads it properly. I can't use a hidden field, as both buttons
Autoslide
I'm having trouble figuring how to make this slide through automatically. I've been trying to figure out how to include setTimeout and or setInterval but nothing is making sense to me. $(document).ready(function() { $(".folio_block").each(function() { //Set Default State of each portfolio piece $(this).find(".paging").show(); $(this).find(".paging a:last").addClass("active"); //Inject <span> for Tool tip $(this).find(".image_reel a").append("<span></span>"); $(this).find(".image_reel span").css({"opacity"
What's the difference between $("ul li") and $("ul > li")?
Don't they return the exact same object? Is the latter more efficient?
Hi! I want to ask for some permission.
Greetings! I am Thomie, I am developing a framework(not for javascript) and I want to integrate Jquery to it. Will you permit me, together with my team , to integrate Jquery? Along we will be putting credits upon using Jquery. We hope for your kind consideration. Thank you and Godbless. Your's truly, Thomie Jose San Agustin
Next Page