Problem hiding subset of form fields (with empty values) using focusout handler.
I have a contact info form with about 16 fields. I need to hide a subset of fields for address when the end user either (1) tabs out of the subset group, (2) clicks anywhere outside the subset field group. I do not want to hide the fields when the end-user is tabbing within the subset of address fields, yet the focusout handler is triggered when it shouldn't be. Any assistance on this is greatly appreciated! $('#Addr,#City,#State,#Postcde,#Cntry').focusout( function() { if($('#Addr').fieldValue()
Adding/removing class question
I have the following code attached to my save button. It looks for textboxes and comboboxes that have requiredText or requiredCombo classes assigned. My problem is that for one of the text boxes, when the user clicks a check box, I use the removeclass function to remove the requiredText class from the text box (I also use the addClass button to add the class back based on the state of the checkbox). But when the save button is clicked it still acts like the text box has the requiredClass class. Is
Issue with FAQ responses to "Why do my events stop working after an AJAX request?"
I've only been using jQuery for a few days and am stuck with the issue that appears to be discussed in the FAQ topic "Why do my events stop working after an AJAX request?". I can't seem to correct the problem with the suggestions, but I may be misunderstanding things... I am building a social-networking type site. I have the ability to post comments (similar to Facebook) and am currently using AJAX to run the SQL INSERT query and refresh the div to which the comment was posted. Said div is set
$(window).is('div') returns error (jQuery 1.4)
$(window).is('div') (or any other element) returns "g.nodeName is undefined". This may be expected behavior, but this worked normally with 1.3.2 (returned false).
Tabs nested in accordion doesn't work - help please!
Hi, I'm trying to nest 7 tab sets in an accordion representing each day of the week. I've tried all kinds of fixes, but no matter what I do, the results are inconsistent. It's easier to see than explain now: http://www.ehydrant.com/trouble/accordion-custom2.htm Can anyone have a look and give me some guidance. I am an amateur jQuery user. Thanks guys!
Opening a new browser window via .ajax
Hello all, My current project has me working with UI dialog and I was wondering if it's possible to open a new browser window from a click of the dialog button. I have set up an ajax call to get the url but I'm not sure if this is the correct way. function createNewProject(irb_id){ jQuery.ui.dialog.defaults.bgiframe = true; jQuery(function(){ jQuery('#confirmDialog').dialog({ title: 'Create New Project', width: 225, hide:{effect: 'blind',
JQuery JSTree onsearch callback
Hi, I have an issue with the onsearch callback functionality in jquery jstree. There is a search option to search down the nodes in the tree. The first time the tree is rendered, if I type in something on the search filter, it is not calling the callback for the onsearch event. But once i manually expand or collapse any of the tree nodes, and then do a search, now the callback for onsearch gets triggered. Any idea of why the callback is not getting triggered in the first attempt? Your help is much
Abstracting methods - best technique?
Is there any difference between the two following things - assume we have lots of divs - $('DIV').each(function() { /* some long and complex logic here */ });or $.fn.myMethod = function() { /* some long and complex logic here */ } $('DIV').myMethod(); I'm thinking that maybe the javascript parser has to reparse the long-and-difficult bit each time in the first instance, but not in the second. But maybe they're actually just the same? Thanks.
Enabling disabled submit button on browser's Back action
Hello Everyone, when the following code is used in my JSP page: $('#myForm').bind('submit', function() { $('#submit').attr('disabled', 'disabled'); }); it disables the submit button when my form is submitted (IDs are used). This action displays a result page. If the browser's Back button is pressed to change some of entered items, the submit button in Firefox is still disabled, while the same action in MSIE8 enables it again. I don't know if this is exactly JavaScript/browser/chache issue, but
Problems using getJSON after upgrading to jquery-1.4.1
After upgrading to jQuery 1.4.1 from jQuery 1.3.2, my getJSON requests fail. The error given to the ajax error handler, is "Invalid JSON: ..." where "..." is the text of the response. Firebug parses the JSON fine, and can display the JSON data as such in its console, and jQuery didn't have an issue with the same data with version 1.3.2. I don't understand why this is happening. does anyone have any ideas?
Problems implementing google translate
Trying to implement googles service for translating via jquery: http://code.google.com/p/jquery-translate/ I have several text fields on a page, each having a corresponding english and swedish language set, named: Field1 Field1ENG Field2 Field2ENG (class .eng) etc When I doubleclick the english field I want jquery to translate the swedish field and insert the translation to the english field. I have got the basics going but stuck trying to find a way to get the information from the swedish field.
$.post and data with $( selector ) does not work since jQuery 1.4
Hi, since jQuery 1.4 I've a problem using $( selector ) in data for $.post My code: settings = $.extend( { attachTo: $( '.top h1' ) }, settings ); $.post( url, settings, function( str ) { if ( str.length > 0 ) { settings.attachTo.after( '<div class="message" style="display:none">' + str + '</div>' ).next().slideDown( 'fast' ).wait( 2000 ).slideUp( 'fast', function() { $( this ).parents( '.approval_offer' ).remove(); $( this ).remove(); } ); }; } ); This code works fine with jQuery 1.3.2 on FF 3.5.6
Serious trouble with Internet Explorer 7
This site uses Drupal 6 and a jQuery script to format numerous texts. It works perfectly on all important browsers but err (and not on all users) with Internet Explorer 7. On my virtual machine with Windows XP and IE7, I have no trouble to see the site. I'm quite lost at this moment about this bug. I would like to know if there is a page somewhere that explains the do's and don'ts regarding jQuery and IE7. The main task of the script is to fetch for some pages a Stock quote (using the .get method).
Difficulties in getting filmstrip to work
Hi All, I am currently working in a filmstrip applet that loads 35 thumbnails (tiny 10x10 px) in a vertical ladder of divs. Thanks to the help of those on the mailing list I have gotten much of the functionality working. I now have the images loading, and the popups popping up with a medium sized image on mouse over. What is lacking now are two things. 1. I need to store the offset value in a session variable or at least in a variable accessible by jquery. The global declaration does not seem to
conflict with mootools
I am very new to all this and i dont how to fix this... is it possible for someone to give me step by step instructions on how to make mootool and jquery working together?? i use joomla 1.5.15. thank youuuuuuuuuuuu
Jquery and Inheritance
Hi!, I need in my project javascript class inheritance like in prototype: var Core = { .... }; AbstractWebForm = { }; CreateProjectForm = Core.extend(AbstractWebForm, { }); In prototype there is class inheritance implementation bases on Alex Arnell`s implementation from: http://code.google.com/p/inheritance/ please, is there any support in jQuery for this. thanks! Ivan Polak
jQuery Loop
<div id="sp-news"> <div id="sp-news-item-1" class="ui-tabs-panel ui-tabs-hide"> <p><b>New Item</b></p> <p>Info...</p> </div> <div id="sp-news-item-2" class="ui-tabs-panel ui-tabs-hide"> <p><b>Application downtime</b></p> <p>Info...</p> </div> <div id="sp-news-item-3" class="ui-tabs-panel ui-tabs-hide"> <p><b>Success</b></p> <p>Info...</p> </div> </div> <ul class="sp-news-nav"> <li class="ui-tabs-selected"> <a href="#sp-news-item-1"><span>New Item</span></a> </li> <li class="">
How to read the "XML format" date which is returned from an API using $.ajax() ?
I would like to get get some data which format is "XML" and it is returned from an API. However, the $.ajax() doesn't work in this case? But the same code works when the "XML format" data is from an XML file. Can anyone tell me why?
Javascript to jQuery conversion - numeric validation.
I want to validate an input field to be numeric with a variable precision, e.g. 1, 1.2, 1.23, etc. If I was doing it without jQuery, it'd look something like this: CODE function validateNum(id, precision){ var regex = /^\d{1,3}\.?\d{precision}$/; if (document.getElementById(id).value.search(regex) ==-1) { return false; } else { return true; } } <input id = 'numeric' onBlur = 'javascript:validateNum('numeric', 0)'> <input id = 'money' onBlur = 'javascript:validateNum('money', 2)'>
Using JQuery to Narrow Down Result Set with Text Search
Hey All, I'm looking to use JQuery to setup something like this: (Textbox input via search) (Multi-select select/option box here with results already populated) There are a large number of results already in the multi-select box and I'd like to narrow them down on the fly by text input into the "search" field. What would be the most efficient way to do this? Any suggestions would be appreciated. Thanks.
index problem
Hi. I am trying to wrap <a> tags around text in <li> elements. How can I get the index of the <li> in the <ul>? I tried something like this: $('.tabbed-list li').wrapInner('<a></a>'); That works fine. However, I want to do something like this: $(this).wrapInner('<a href="#' + $(this).index() + '"></a>'); Would be great if you could help. Regards Simon
Update div content after dynamic select creation
I'm trying to create a page where onchange of first select it appears a second one (which values, readen from a database, depend on previous choise) and on choise of second select results are show in a div. Here some images: Start: On first select choise: On second select choise: Here's the code: index.php <html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type"
how to apply an opacity effect
Hello. I have several images as thumbnails on my page and applied the 'changeImg()' function the onmouseover event. It then shows the thumbnail image as 'big' image at a certain position. It looks kind of boaring and it would be nice to apply jquery to have a nice effect ... opacity or fadeIn. Problem: after quite some time I still don't seem to be able to integrate it into the existing javascript function. here what I have so far: <img class="small" src="images/01.jpg" onmouseover="changeImg(this);return
How can I handle ActiveX events in jQuery?
Hi How can I handle ActiveX events in jQuery? Ciao
<a>, php and jquery
Hey! I have one problem, which i should solve. Of course, i could do my job as i done all the other times, but anyway, i would like to use jquery :) Okey, here is my question. At the moment I'm making site. With PHP and MySQL of course. In example i have anchor tag, and I'm sending to adress bar, in example index.php?section=4&edit=7, where edit=7 is database ID for article. If I'm doing like this: <a href="?section=4&edit=7">Edit Article ID 7</a>Then i could easy to say PHP if($_GET['edit']), then
how to use onLoad when anothe library is also using it
hi im new to jquery. im trying to help out a friend of mine who has this page with tab effect.he is using a different library.and i think it is already using onload behind the scene. so in a situation like that how can i use jquery can i use onload on jquery as well. will it work.
Passing radio button value into AJAX url
Hi All, I have code like this: $(function() { $.ajax({ url: "lookupSchool.aspx", data: "id=" + $('input[name=rdoStateGroup]:radio:checked').val(), dataType: "xml", success: function(xmlResponse) { var data = $("result", xmlResponse).map(function() { return { value: $("jrfh_suburb", this).text(), id: $("jrfh_suburb", this).text() }; }).get(); $(SUBURB_TEXTBOX).autocomplete({ source: data, minLength: 2, select: function(event, ui) { $("#hdnSuburbID").val(ui.item.id); urlSchool = urlSchoolState
change document.write into jquery
Hi I'm trying to create widget, using jquery and php file. firstly, i have html file with javascript link like this: <script type="text/javascript" src="includefile.js"></script> this script include javascript file with compressed jquery library and function, which include php file. I'm using Ajax to include php file $.get('myfile.php', {skintype: skin}, function(data){ $(this).html(data); }); And now, my problem is, that this function doesn't response correctly beouse of this: $(this).html(data);
Beside jQuery what are the other JavaScript frameworks using Sizzle selector engine?
I am just curious. It seems at this point of time Sizzle rules. Still I would like to know what other frameworks are using.
in-page .ready function getting crazy - what am I missing?
I wrote a nice AJAX-driven directory for my organization that allows people to search in various ways. I have installed it on all of the organization's pages as a modal dialog. So far, so good. Because the interface has many options, I have a ton of .click .change .keyup .mouseup listeners. This means I have about 40 lines of jquery in the header of all my pages in the .ready call. This seems really inefficient, since that code has to be loaded each time. Is there technique that I missed while teaching
How to speed up dom insertion when used with data()
Suppose I want to populate a drop down ajaxly. The population is written like: var $select = $("#target"); $.each(datas, function(){ $("<option/>") .val(thia.value).html(this.name) .appendTo($select) .data('srcData', this); });But the speed is considerably slow when the datas is large. I know that I can use just string concatenation and html() finally to speed it up but what can I do with the data()?
Ajax error trap basic problems
I am trying to catch a few basics errors that at some point I expect to happen in an application under development. For example two basic cases spring to mind: Server down Some sort of malformed call to the server code that results in a non standard server response (e.g., PHP error message is returned). My current design is that the server code always responds with html MIME type. Typically it issues JSON data back to the client. What I don't get is that if I turn off the web server and then run
Can I flag "nice addition" "very useful" comments in the documentation?
I started looking at the new docs today and I'm seeing a lot of noise in the comments... people have posted comments like "thanks", "very useful", "great addition". For example, see the .toArray() page. I could add a "very useful" comment to about 50 jQuery pages -- would anyone care if I liked those? I don't think they should. IMHO, these kinds of comments are better suited to personal blogs. Is it okay to flag these comments so they get removed? or is that an improper use of flagging? If I
Every time I read a jQuery book...
Every time I read a book on jQuery, there is the mandatory part about unobtrusive JavaScript, and it's usually followed by some suggestion that the page should work fine if JavaScript is turned off. Isn't this getting a little silly in the age of Ajax-driven pages? Javascript-delivered page data is no longer trivial icing on the cake. It is the cake. Try using Google maps with JavaScript turned off. 99.99% of browsers have JavaScript and if someone chooses to turn it off, it seems to me they can
Finding a child element of a wrapped set
Hello, I'm trying to add a click listener to a list element that has a hidden unordered list. <script type="text/javascript"> $(function(){ $('li:has(ul)').click(function(event) { if (this == event.target) { if ($(this).next().is(':hidden')) { $(this).next().show(); } else { $(this).next().hide(); } } return false; }) }); </script> /* With a list something like this */ <ul> <li>One</li> <li>Two <ul> <li>Two.one</li> </ul> </li> </ul>
StackOverflow Moderator Voting
I know there is some overlap in the forums with StackOverflow, so I just wanted to mention something about the moderator voting that just started yesterday. Two of the users running for moderator spend some (or almost all) of their time in the jQuery and JavaScript tags on SO. The two current StackOverflow moderators (who will remain) are experts in Java and C# respectively. I think it would be really great to get a moderator on StackOverflow that has his own special interest in jQuery and JavaScript.
Changing backgroundImage on hover?
Hi there, I just started using jQuery and I wanted to know how I can change the background-image when I hover my cursor of a li. I have this code: $(document).ready(function(){ $("#button_news").hover(function () { $(this).css({cursor : 'pointer', backgroundColor : '#1C1C1C', color : '#CFCFCF', backgroundImage : 'url(../images/bullet_pink.png'}); }, function () { $(this).css({backgroundColor : '#1E1E1E', color : '#444', backgroundImage : 'url(../images/bullet_black.png'}); }); $("#button_news").click(function
DOM creation - character entities?
So say I have something like this: $('<span>', { text: ' this is a test – see?' }); The ndash will just show up as is. How can I get it to actually show the character it represents?
.load() with submit paramaters
Hey guys! I'm 1 day new to jQuery and I'm having an issue. I have a search box for a load environment, and I cant just load a simple search.php?field=123124312 Right now I have $("#table").load("/search.php?search=780073404721 #0001"); I need to be able to set those numbers to anything submited through my input field. Any ideas?
$.each($("select"), function(){ 'i dont work' });
I'm trying to loop through the <select> items on the website but it does not work. How can i fix this? <select name="X" onchange="go()"> <option value="result">Result</option> </select> function go() { $.each($("select"), function(){ alert($(this).val(); }); }
Next Page