deferred.resolve() - query on usage as a callback
In this question on Stackoverflow, I suggested use of $.Deferred() My original fiddle for a solution used a separate callback function which just called def.resolve(). However I then remembered that I've seen other code simply pass "def.resolve" as a callback in its own right. I tried this instead, and it works (see http://jsfiddle.net/Nyg4y/3/). This got me wondering - how does this work? As I understand it for this to work at all the value 'def.resolve' must be specific to 'def'. This suggests
how to remove the elements returned in an array?
hello, i have a var ids = [] that returns some id's. for example <li id="11"></li> <li id="12"></li> the variable ids will be return 11,12. what i want to do is to find those <li>'s with those id's and remove them. thanks,
Coordinates Function
Is there a way to write a function that would be.... If the coordinates of an image are _____ then do this ______ ?
One function to slideToggle dynamically added elements
My page will have 100+ links on an image map. Each of these links will have a hidden div associated with it. i.e. So the first link when clicked should toggle it's corresponding div. I don't know why this isn't working. any help is appreciated. <!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> <script type="text/javascript" src="jquery.js"> </script> <style type="text/css">
Strange jQuery error?
I am deploying a new part of our website, and everything was working fine while I was deving on my local machine. After uploading the scripts, Firebug returns an error but it is not at all descriptive of what it doesn't like. The error says: $( Cancel: function () { <filename><line number> Does anybody have any suggestions of what this might mean? The error happens when you click the "edit" button next to a row, and a jQuery dialog pops up. The line number points to where the Cancel button is
Setting class on td with attr
Hi, I am pretty new to jquery and am trying to set the class value on a td cell. It looks as though it is crashing on setting the attr value. This is effectively what I am trying to do. // get my row var row = $("#tableID").find("tr:eq(0)"); // get the cells in this row var cells = row.find("td"); // manipulate the cells cells[1].innerHTML = "Some Text"; cells[2].attr("class", "my-class"); Setting the innerHTML works fine, so I am assuming everything before that is working correctly. When I try
how to find the id of an <li> from another file on the server ?
hey people... i've got a file that contains multiple <li> with different id's: <li id="1"></li> <li id="2"></li> <li id="3"></li> ... how can i gram the those id's and put them into a var? var get_id = $source.find('li').attr('id'); ??
.val method returning "on" for dynamically created radio buttons in ie9
Hi, If I dynamically create a radio button via "createElement" and then use the :checked selector and the val method I get "on" returned in ie9. This doesn't happen with a radio button created via HTML. Test code: <div id="test"></div><input type="submit" onclick="window.alert (jQuery('#test input:checked').val ());" value="Click Me!" /><script src="/js/jquery-1.5.1.js"></script><script> jQuery.noConflict (); var el = window.document.createElement ('input'); el.setAttribute ('name', 'hello'); el.setAttribute
JQuerry Board Game
Hi Folks, I am trying to get a "game piece" to move around a board. I have it animating with a die that it rolls. So if you roll a 6 it will animate 6 times 110px. Each box on the game is 110px. The problem I am having is changing the direction of the animation once it hits a certain point. Any thoughts or ideas? I am new to jQuery. Below is my code. and here is the test link http://kyledicke.com/game/index5.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Access the Object that was clicked?
Hello everybody, i have function appended to a click event of more than one objects. How can i check if the object that was clicked has a certain class xy? var t = jQuery(this); jQuery(t.children()).click(function(e) { if (??check if the element that was clicked has class xy??){} }
linking to item within toggle (show/hide)
I am using this code to separate information into sections using show/hide. I want to be able to link to a specific item within a section which is also within a tab. Example: I want to link to Bret Fetzer in Cultural Programs which is in the Staff tab. http://www.4culture.org/test/about/leadership/ Is this possible? I am already using #staff to open the staff tab. thanks in advance!
How to split the responsetext
I use this on a select box: <script type="text/javascript"> $(document).ready(function(){ $("#states").change(onSelectChange); }); function onSelectChange(){ var selected = $("#states").val(); if (selected.length > 0) { $.post("pwcheck.asp", { state: selected }, function(data) { $("#output").html(data); }); } } </script> and it works great. What I want to do is write to two divs instead on only one (#output). I created an ASP page that returns text~~~text2.
Is it possible to get the current id in the URL (#something) kinda like CSS3 :target
Hello, Well, I think the title sums it up, but here it is: (optional scenario, just skip this part if you just want me to get to the point of the question): for one of my classes, I have to make a website for a non-profit organization. I have a three-level menu: Section 1 > Page 1 > Subsection 1 - 2 -3... etc. The way it's organized is "sections" are tabs, "pages" are buttons and "subsections" are accordion items, basically. I want to be able to access the accordion items using the url, because my
jQuery 1.5 Ajax Converters
Can someone point me to possible a more thorough explanation of how to use converters? I understand what they are to be used for, I just need a better explanation of the syntax involved. For example, on the jQuery site, under "Extending Ajax", there is the following as part of the explanation: $.ajax( url, { dataType: "xml text mydatatype", converters: { "xml text": function( xmlValue ) { // Extract relevant text from the xml document return textValue; } } });dataType has 3 values (xml, text and
ajax xmlHttpRequest is undefined
Hi I'm having a problem getting the error status when a session expires on the server when i receive an http status of 401 the error function alert returns xmlHttpRequest = undefined , textStatus = "error" & errorThrown = undefined how do i get the status of 401 returned to my application ajaxError & statusCode don't seem to work as well what am i missing my ajax code is as follows jQuery.ajax ( { type: 'POST', dataType: "html", contentType:
Background changer
Hello, Im not sure what is wrong with my script : | When i alert new background styles, it looks ok. When i click #go1, background disappears, but than appears same background : / I want to change it to bg+l+.jpg where l is number of background (i have 4 backgrounds). Script: <div id="inner" style="background:url(bg1.jpg) no-repeat center">Jakis tekst</div> <script> var l = 1; var str = "url(bg"+l+".jpg) no-repeat center"; $('#go1').click( function(){ $('#inner').fadeOut( 'slow', function(){
How to keep a link active (as a normal link) inside an accordion
Hi I'm new to jQuery and have a problem with links inside an accordion. The simplified code looks like this: <div class="active-item"> <div class="available-items"> <h5>Headline</h5> </div> <div class="table-accordion"> <table> <tr> <td><a href="#link">Row 1 --- Content</a></td> <td><a href="#link">Row 2 --- Content</a></td> <td><a href="#link">Row 3 --- Content</a></td> </tr> </table> </div> </div> The jQuery is adapted from
how to after submit got to insert.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- <?php include_once 'common.php'; require_once("pages/validation.php"); ?> <? if (!$_COOKIE["ln"]){ $data['lang_ch']=$data['DefaultLanguage']; setcookie("ln", $data['lang_ch']); } ?> --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title></title> <meta name="keywords" content="" /> <meta name="description"
The same id radio buttons dosent work on post form.
Here is a script and its uses a latest jquery $(function() { $(".submit").click(function() { var name = $("#name").val(); var surname = $("#surname").val(); var gender = $("#gender").val(); var birthyear = $("#birthyear").val(); var birthmonth = $("#birthmonth").val(); var birthday = $("#birthday").val(); var town = $("#town").val(); var country = $("#country").val(); var postalcode = $("#postalcode").val(); var dataString = 'name='+ name + '&surname=' + surname + '&gender=' + gender + '&birthyear=' + birthyear + '&birthmonth=' + birthmonth + '&birthday=' + birthday + '&town=' + town + '&country=' + country + '&postalcode=' + postalcode;
unordered list to Form Value Help please
I have an unordered list that I want a user to be able to click on a List Item then that is sent to a Form Text Input as its value. I do not want to use a select list, this Unordered list has to be visable at all times, im just stuck on the Jquery code to write that selected List Item in a text value box on a basic form. Please Help me. Thankyou
Passing variables between pages
On the response to my first post, "Passing Variables", I see how to use the cookies. How would I use session variables? I thought you could not access them via jquery.
NOT_FOUND_ERROR when using the text() method.
I'm seeing something truly bizarre, after upgrading to jQuery 1.5.1 SO thread here: http://stackoverflow.com/questions/5331694/jquery-1-5-1-throwing-not-found-err-dom-exception-8 Basically, at certain points of my app, I am getting a NOT_FOUND_ERR: DOM Exception 8: An attempt was made to reference a Node in a context where it does not exist. When I do something as simple as: $('.price').text('123'); I've traced it to the append() method. append: function() { return this.domManip(arguments,
Superfish Problem with IE, FF, SF
I have superfish setup for the top navigation and it works great in IE, but in safari and Firefox it won't display right. I have gone through the code, but I am not sure where the problem lies. Here is the code that I have. /*----------------------- */ #navbg ul { text-align:center; } #navbg ul, #navbg ul * { margin:0; padding:0; list-style:none; line-height:46px; } #navbg ul li ul { position:absolute; top:-999em; width:150px; /* left offset of submenus need to match (see below) */ } #navbg
I'd like to store some internal Javascript object like Range but I haven't found a way to save it.
I'd like to store some internal Javascript object like Range but I haven't found a way to save it. What's the best way to save it ? I thought to serialize it but I haven't found anything on the net
Help with Syntax
Hey all, I am new to working with variables and am trying to get this function working. I was wondering if anyone can help me find the problem in it. Thanks! <script type="text/javascript"> $(document).ready(function() { $('.partners_internal_product_select input[type=radio]').live('change', function(){ //Setting up the chenge event for the radio button var AffectedRegistration = $(this).closest('.partners_internal_product_registration'); //Select the nearest
ajax
I find ajax with jquery more confusing than with regular JS, b/c in jQuery you don't declare XMLHttpRequest object.. so how do you do something like $('#testFromAjax').append(xmlHttp.responseText); ??? (assuming of course that 'xmlHttp' eval's to XMLHttpRequest object) in example I mention here, http://forum.jquery.com/topic/ajax-php-7-3-2011-1 namely http://www.bitrepository.com/a-simple-ajax-contact-form-with-php-validation.html I don't understand where var 'msg' is declared, I know
Nesting easyslider in tabs - help required
Hi, I'm working on a project and have been troublshooting an issue I have with nesting an easy slider inside tabs. This is the page issue page - you will notice that when a tab is selected in the content area the slider navigation falls away. I need to resolve this, any help or advise would be great. regards, Brandon
Help - capture image info for a thumbnail caption.
Apologies because I think this should be straightforward - have looked at loads of plugins and code but can't get anything to do what I need. Basically I have thumbnail images (no classes assigned - just alt and title completed) inside divs with a class of 'slide'. Nested within the slide div is another div at the bottom called 'caption1' - all handled via css / html. What I want to do via jquery is automatically capture the image file name (not location) and possibly the image alt and or title
Trouble with idTabs - getting info to switch ?
Hi I would like to use idTabs to display more product information within my zen cart store page. http://www.vivanco-direct.com/IP-CCTV-Cameras-1/The-Cube-Wireless-HD-IP-Cube-Camera I am currently trying to get the structure and layout correct and could use some help with when the tabs switch to show the related tab information. as the information in which I want to display using the tabs is just being shown on one page if I selected a tab it takes me to the section of information relating to the
Resize browser window
Hi everyone! I am trying myself on a little script which is supposed to resize the browser's window once it's loaded. So far however with no luck: $().ready(function () { $(window).animate({ width: 750, height: 500 }, "slow"); });Anyone may knows a solution? Thanks in advance!
Fade In ok, Fade out not ok. What the reason?
I actually have a JSP page with this basic HTML elements; <div style="display:none;" id="loadingBar"><img src="images/loading-big.gif" alt="loading"/> </div> <div style="display:none;" id="result"></div> and then the JQUERY with these source code; var content; var dataString = "ha"; $( function() { $.validator.addMethod("username", function(value, element) { return this.optional(element) || /^[a-z0-9\_]+$/i.test(value); }, "UserID: only letters, numbers, or underscore.");
The min-weith and min-height in IE6
How to resolve the problem that IE6 don't recognize with the min-height and min-width attribute of CSS?
How to count occurance multiple element with a same name?
Heelo everyone...! I confused. I could count all elements by using $(input:text).length But how could I count many element that has a same name? Lets assume <div> <input name="username" class="required" type="text" value="- none -" size="33" maxlength="50"> <input name="username" class="required" type="text" value="- none -" size="33" maxlength="50"> <input name="another" class="required" type="text" value="- none -" size="33" maxlength="50"> <input name="sample" class="required" type="text" value="-
javascript regex and a span that can not changed
Hahaha, hello again everyone... Pardon me if i'm a bit confused while trying this jquery. This week I'm with jquery almost in every day.... GeeZZ.... (may god forgive me). Anyway, here I have; 1 textfield namely as ipaddress 1 span with unique ID as warn and once I use this jquery; (to validate each time the user type something at that input textfield). $('input[name="ipaddress"]').keyup( function(){ var regexp = /^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/
Navigation Question (inc Doormat) - Hopefully an easy one
Hi there. I hope this is the right place to ask this and sorry if it's been asked many times before (I did try and have a look). Q1.) I am looking at using a top horizontal navigation menu like http://www.johnlewis.com/ and wondered if there were any real downsides at using it on a large global level? I assume it only functions if java is installed so would restrict those users who don't? Also, not sure if it works on mobile devices like bb's? Q2.) Would you regard that type of navigation as
asp.net objects
My original post was: I'm new to jquery, but i think with document.getElementById( "TextBox1" ); you don't use jquery. Try $("#TestBox1") instead. ASP.NET Objects are rendered as normal HTML, because of that jquery should find these elements. you can check the generated html and if the textbox has an id attribute it should work. When I use $("#TextBox1") I get an error "object expected".
Slideshow Images Tiling on certain pages
I am using jQuery with a Brightpearl website, except on one of our pages, (edit your address book page), the slideshow images, instead of fading one into the other as it should, decide to tile over the top of the page and don't fade at all. The input boxes show through, but not the submit button, so it renders the page useless. Any suggestions?
Adding week number and week range to DropDown List in ASP.NET3.5 using JQUERY.
Hi friendrs, I am learning Jquery. I have a requirement that I have to add week number and week ranges in a year( I select year in another dropdown list) to a dropdown list. And I have to pass selected week number to sql server. I want to do this using jQuey . The dropdown list shows like below. 50 8 MARCH 2010 14 MARCH 2010 51 15 MARCH 2010 21 MARCH 2010 52 22 MARCH 2010 28 MARCH 2010 How can I acheive this? Regards, JN
how to get the id of an element and compare it with another one?
hello. i have a file called text.txt that contains: <li id="unic1">some text</li> <li id="unic2">some text</li> and a index.html where i try to find the id from the previous file: <div id="div">alert(unic_id)'<div> $(".div").load('text.txt'); var $unic_id = $source.each(function(){ .find('li') .attr('id'); }); what am i doing wrong? thanks
slideToggle stopped working in IE 9
Hi, I've had no problems until I upgraded to IE 9. I'm running jquery 1.4.4 and also tried it with the newest version. In IE 9, it will work if I switch the browser to IE 8 Standards Mode. When I switch it back to IE 9 Standards it stops working. By stop working I mean I click on the button and nothing happens. Here is the javascript: jQuery.noConflict(); var $j = jQuery; $j(document).ready(function () { $j('div.menu_class').click(function () { $j('ul.the_menu').slideToggle('medium'); });
Next Page