strange mannerism of .each()
hey guys this is not really a problem because i've found another way but i want to understand jquery properly. i have following code structure: <div id="a"> <div class="b c"></div> </div> when i trigger $( "#a > .c").each(function( index ){ //...}); it selects correctly all elements with class='c' under div #a. If I write instead: $( "b + c").each(function( index ){ //...}); it triggers all elements with class='c' under div #a except the first element. Do you know why this is like that? Thanks
Problem with getJson on safari (iphone)
I try to execute this code exemple using external webService $.getJSON('http://domain.fr/testJson/test.json', function(data) { var items = []; $.each(data, function(key, val) { items.push('<li id="' + key + '">' + val + '</li>'); }); $('<ul/>', { 'class': 'my-new-list', html: items.join('') }).appendTo('#home'); }); the test.json is on a server : { "one": "Singular sensation", "two": "Beady little eyes", "three": "Little birds pitch by my doorstep" } It works in
When to use $find?
Hello, I was hoping someone could clear up a question I had. When is it necessary to use the $find method when I have a selector? Thank You
Help jquery app
I'm trying to make a unit conversion app but seam to be failing at the most simple peace of code. Could someone please help me getting this work? var from = $('#selectmenu10'); var to = $('#selectmenu11'); var value = $('#textinput1'); var result = ''; $(function() { $("#sb1").click(function() { if (from.val() == 'Euro' || to.val() == 'Dollar') { result.val(value.val() * 1.29840); alert(result + ' Dollar'); } } }); });
Can I open a div injected from a ajax request in a dialog?
Hi guys, Can I open a div injected from a ajax request in a dialog? Example Html <button class="clickme">Click Me</button> <div id="result"><div> Php if ($_REQUEST["action"] == 'greetings'){ echo' <div id="hello">Hello<div>'; } Jquery $(document).on('click', '.clickme', function(){ $.ajax({ url: 'php/function.php', type: 'post', data: {'action':'greetings' }, success: function(result) { $("#result").append(result); $( "#hello" ).dialog({
how do i select the correct .each(function(index) from list ?
hello. how do i make it so that if i click on a link it will make the parent index do something ? http://jsfiddle.net/rickyspires/m6kXR/35/ so i have a list of divs and an empty container <div id="book"> <div id="page1" class="page">1</div> <div id="page2" class="page">2</div> <div id="page3" class="page">3</div> <div id="page4" class="page">4</div> <div id="page5" class="page">5</div> </div> <div id="book_nav"></div> them from that i get 5 links $('.page').each(function(index){
Review copies available for Instant jQuery 2.0 Table Manipulation How-to
We have a few e-copies of Instant jQuery 2.0 Table Manipulation How-to (http://www.packtpub.com/jquery-2-0-table-manipulation-how-to/book) available for review. If interested, just drop a line below with following required details: 1. Email address 2. Choice of website for posting your book-review (can be your blog or website, Amazon.com or goodreads.com) Instant jQuery 2.0 Table Manipulation How-to is a short, fast, focused guide on editing and manipulating your HTML tables. The book shows readers
Doing a partial postback.
Hi, I am using a componentone carousel control to view thumbnail photos. On the client click I want to do a partial postback so I can load the photo in a larger image but at the same time lay on top some blob divs. I can do this $(".imgSave").click(); Which does a full postback and the whole page is loaded and it looks clunky. Is it possbile to have it simply partial postback which simple loads the new image and moves the blobs on the photo with out a full page load? Many Thanks, Jiggy
Using jQuery object/chain as a selector string for delegated events with .on() not working
Sorry for the confusing title.. basically I was wondering if this was correct behaviour: If I have some images each wrapped around in an anchor link and I do $(document).on('click', $('a').children('img') , function() { // code });example: http://jsfiddle.net/eawEV/ Clicking any image inside 'document' will trigger the event regardless of the selector filtering only images that have anchors as parents? As opposed to using a string for the selector $(document).on('click', 'a > img' , function()
Toggle Onclick value if checkbox is checked
Hello, I have a form that uses multiple actions, and what I'm trying to do is toggle the onclick value. <form> <input type="text" name="email" id="email" value="Email" class="text-input" /> <input name="" type="checkbox" value="Yes" /> <input type="submit" value="Button1" name="subscribe" id="subscribe" class="button" onclick="OnButton1(); OnButton2();"> </form> basically, what I want to happen is, if user check the checkbox, OnButton1(); will be added and if not, OnButton1(); will be removed.. It's
Send a GET/POST/AJAX request to a "File" Not Url On A Server
Is this possible in jQuery? From what I'm seeing you can only use a url in $.get(url, ..) or $.post(url, ..). Instead I want to do either or to a file on the server like $.get(filename.php, ...) or $.ajax(filename.php, ..). This php file is returning information. How can I do this?
Dynamic draggable map
I have been working on a map, that is dynamically updated using jquery. the map is set up so that each 'cell'/location on the map is an object/image. Contents are stored in a database, and accessed via PHP. When you mouse over an image, a tooltip pops up with the cell's content information. When you click on the cell, a function is called, and actions are performed accordingly. Right now, i have a call that updates all the cells in the view that is performed when the 'refresh' button is hit. This
Uncaught type error : object [object object ] has no method captify
Hi, i am using this code in one of my wordpress theme for slider but when i activated one plugin i got this error jQuery(document).ready(function(){ jQuery('img.captify').captify({ Uncaught TypeError: Object [object Object] has no method 'captify' speedOver: 'fast', speedOut: 'normal', hideDelay: 500, animation: 'slide', prefix: '', opacity: '0.7', className: 'caption-bottom', position: 'bottom', spanWidth: '100%' }); }); please help me to fix this problem Thanks
how to differentiate 401 http response from server not found response?
Hello. I have serveral URIs, which i check with jquery.ajax(). If URI is exist, mark it as good; if not - as bad. But $.ajax() set status to "error" for URI, which reply with 401 http code, and for URI, that doesn't reply at all, too. How can i distinguish URI with existence server from URI with non-existence server?
$this not working ?
hello i can not seem to get this to work . i what to add class of hooked to a div with the same class. this is the jquery 1- when you click a.book_nav_item it first look for the class of the button clicked. 2 - then it looks through all the #fliphtml for the same class 3 - when it finds the same class i want it to add the class hooked to #fliphtml $('a.book_nav_item').click(function(){ //GET PAGE NUMBER var pageNumber = $(this).attr('class').split(' ')[1]; if ($('#fliphtml').find(pageNumber))
how to determine the is in which the user clicked on with jQuery?
Hi again I have list of link <a href="?id=1" class="test">enable user 1</a> <a href="?id=2" class="test">enable user 2</a> <a href="?id=3" class="test">enable user 3</a> <a href="?id=4" class="test">enable user 4</a> when I user click a link I create a dialog box using jQuery UI like so <script> $(function($){ $( "#dialog-confirm" ).dialog({ resizable: false, height:175, modal: true, autoOpen: false, buttons: { "Yes I am sure. Process": function(e) { console.log($.urlParam('url')); //I need to
Tooltip Plugin. Allow mouse to move hover. And positioning
Hello, I am creating my own toolip JQuery plugin as I need it to behave in specific ways. So I have the following: http://codepen.io/mdmoura/pen/pbvnG When the mouse is over the "Text Tooltip" the tooltip becomes centered. I am doing this at the end of mouseenter function. Is there a better way to center the tooltip with the anchor? At the moment when I move the mouse out of the anchor the tooltip disappears. Is it possible to give, maybe, 1 second so the mouse can move over the tooltip? And the
Off Canvas menu with browser fallbacks
Hi guys, I think I have an interesting problem that could be usefull to a lot of developers out there looking to create off-canvas menus (similar to facebook) on smaller screen sizes. After searching high and low and reading through many options, I found this great solution for off canvas navigation http://tympanus.net/codrops/2012/12/11/fullscreen-pageflip-layout/. I tested it in IE7 and it still works, even if the animation isn't there, it still has the function. The problem I have is as follows:
how is this done? (drop down nav)
how is the main "sections" nav done here??? all I see in the markup is the ul li for the main links in the top-level nav.. for example <li class="business" data-section="business"> the data is here (.jpt extension) what is this? I thought because it uses stuff like "data-...." attribute in menu markup this was maybe done with jQuery? with what is described here? thank you.... PS: there are so many methods for doing dropdowns.. it's mind-boggling.. www.1stwebdesigner.com/css/38-jquery-and-css-drop-down-multi-level-menu-solutions/
JSON result of .ajax() is UTF8 but not always seen as UTF8 ?!?
Hello, I have an ajax function that receives form data serialized and returns a JSON object. The odd thing is that sometimes the answer is correctly seen as UTF-8 but most of the times, it is seen as something else (latin1 ?) and I don't see "Ce nom est déjà pris" but "Ce nom est déjà pris" (UTF-8 re-encoding). The ajax function is called like this : $.ajax({ url: "/ajax/validateUserForm.html", dataType: "json", data: $("form#userform").serialize(),
Having to press submit button twice
I am developing an ASP.Net MVC application and I have form containing a file upload HTML element and a submit button. When the user first goes to the view, I have javascript code automatically triggering the click event on the file upload HTML element so the user does not have to press the button themselves. This is for convenience and the way I want it to be, but when I trigger the button click automatically it is causing the following issue: I have to press the Submit button twice in order to submit
Please provide also HTTPS download from jquery !
when using Jquery with google Chrome I ran into following problem: [blo cked] The page at https ://whatever ran insecure content from http: //code.jquery.com/jquery-1.8.3.min.js . The Problem: Chrome does not allow mixing https and http. So it would be nice, if there will be beside: http: //code.jquery.com/jquery-1.8.3.min.js also https: //code.jquery.com/jquery-1.8.3.min.js so I then I may modify the following code: function addJQuery(callback) { var script script = document.createElement("script");
What does $([]) do?
I see it at here: http://jqueryui.com/dialog/#modal-form allFields = $( [] ).add( name ).add( email ).add( password ), What does it do? Thanks.
slide shwo not working!
Hello; Why doesnt this slideshow work? Thanks
Need Help Simplifying This Script
Hi, I have created avery basic show/hide div slider and need help simplifying the script. I have posted a demo here: http://jsfiddle.net/yKuPr/ I would like to simplify/shorten the script but maintain functionality. Any help would be greatly appreciated. Thank you.
How can I set a cookie value when a user leave the page?
Hi I have a seconds counter in my page and I want to keep the counter when a user jump between pages. So I though I can save the total seconds in cookies variable when the user leave the page and then retrieve it when ever they come back to the page. this is what I have currently but I want to trigger this even when the user navigate out the active page var currentCount = $.jCookie('callTimer'); $.jCookie('callTimer', Number(currentCount) + 1000 ); }, 1000); also how can I check if the cookies
Problem with dynamic site works in IE8 and does not work in 9
Hello friends. I have problems with dynamic site works in IE8 and does not work in 9. Works well the "Tab One" (-menu upper-) by default (shows section "column" and "content" internal), but when I go out and I click on another tab and then return to "Tab One" only shows "content". I need to show on the first tab "column" and "content", as it is by default. See example with default: http://jquerytest.zxq.net/ Files: http://www.mediafire.com/download.php?zotek8b4vwr4b40 jquery: load : function(url)
jQuery 1.9.1 Error - Occurs with IE but not Chrome
I've posted a question on StackOverflow about a jQuery error I'm getting in IE but not in Chrome. Instead of repeating the question again here, the link to the question is here: http://stackoverflow.com/questions/15869586/jquery-1-9-1-error-occurs-with-ie-but-not-chrome For now I have a work-around, described in the question, that seems to get around the problem, but I don't know if it's the best approach. By the way, in the MVC View where this error is occurring, I'm not passing any JSON data to
hide() and show() on mouseleave or mouseout
I am using hint.css and would like to have the tip hide when the div/class is clicked and turned on when the use mouses out of the div/class. I thought what I have here was pretty straight forward. I am surprised it didn't work, what am I missing? Thanks! <div class="promo"> <div class="offer hint--top hint--info hint--rounded hint--info" data-hint="PUT SOME COOL COPY, TO GET PEOPLE TO CLICK!!!"></div> </div> $(document).ready(function() { $( '.promo' ).on('click','.offer', function(){ $(this).hide();
Checking if radio is selected causes false returned
Hi. I have written a little validation script to check a few fields in a recent project. The last part, which checks if a radio input group has a checked element is failing. For some reason it is returning false after it has run once. if (!$("input[name='print-options']").is(':checked')) { $('.prompt-radio').show(); required = false; } else { $('.prompt-radio').hide(); } Can anyone see what the mistake is? Here is the full script. $('form').submit(function(e)
Jquery. load Naviagiton Problem
Need some help, had some help before but have come stuck again.. so any advice or any pointers in the right direction would be great.. i have a main index page which loads separate external php pages into a content div.. my problem is i have the navigation section inside each individual external page.. Navigation Section - in each individual external page <nav> <a class="brand" href="#">Logo</a> <ul> <li><a href="index">Home</a></li> <li><a href="work">Work</a></li> <li><a
[jQuery] flexigrid Internationalization - how to...
Hi, flexigrid(<a href="http://webplicity.net/flexigrid/">http://webplicity.net/flexigrid/</a>) haves a very nice method for internationalization. Looking like this: buttons : [ {name: 'Add', bclass: 'add', onpress : confirmAddDelete}, {name: 'Delete', bclass: 'delete', onpress : confirmAddDelete}, ], searchitems : [ {display: Admin Code', name : 'cdAdmin'},
page reDirection into animation Question
So, I have some one who wants to leave one page by clicking a tab, and causing the site to automatically go back to the index page and play a scrolling animation on a one img slide show to a new location, before following through with the redirect to the original page the tab that was clicked was meant for. Is this possible? Here is a reference of the site. The index plays the animation, then goes to a page, which then goes to other pages similar. They want to go back to the index and mimic the animation
Help me check the script! Thank you!
Why the script can't demonstrate its effect on the webhosting while it can on local pc. <script> $(document).ready(function() {var _0x4828=["\x73\x6C\x6F\x77","\x72\x65\x6D\x6F\x76\x65","\x2E\x70\x72\x65\x41\x44","\x66\x61\x64\x65\x49\x6E","\x23\x53\x48\x4F\x57","\x66\x61\x64\x65\x4F\x75\x74","\x68\x74\x6D\x6C","\x23\x73\x65\x63\x6F\x6E\x64\x73","\x66\x61\x73\x74"];function endCountdown(){$(_0x4828[2])[_0x4828[5]](_0x4828[0],function (){$(_0x4828[2])[_0x4828[1]]();$(_0x4828[4])[_0x4828[3]](_0x4828[0]);}
Javascript Json array with Jquery each going empty
var array = []; $("[id *= 'page']").each(function (index) { array.push([{ "Obj": "1" }]); }); alert(JSON.stringify(array)); I am getting empty in alert. What is wring with my code. Plz help me out???
.getJSON() error when crlf doesn't match os's liking
function getRandomQuote() { var quotes = [], randomIndex, quote; $.getJSON('/quotes.json', function(data) { //http://api.jquery.com/jQuery.getJSON/ $.each(data, function(quote, cite) { if ('' != quote && '' != cite) { quotes.push(quote + '|||' + cite); } }); }) .done(function() { console.log( "JSON success" ); }) .fail(function() { console.log( "JSON error" ); }) .always(function() { console.log( "JSON complete" );
toggling images with click
I have h5 headings with a plus image (close.png) next to each one. When I click on the h5 heading I want the hidden text underneath to appear and have the image switch to a minus (open.png). This is what I have so far. But swapping of the image doesn't work. HTML: <h5>How do I join?</h5> <div class="answer"> <span style="font-weight:normal;">Simply click on the JOIN button. It is that easy! Fill out the fields and when you are done, click on the privacy agreement and then submit. Your application
jQuery Class Selectors - referencing individual elements
Is there a way to reference individual indexes of items within a class selector, when using a for loop? It's probably best if I explain what I am trying to achieve. I have three combo boxes which I would like to fill with, pretty much, the same items. <select name="cboOne" id="cboOne" class="myCombos"></select> <select name="cboTwo" id="cboTwo" class="myCombos"></select> <select name="cboThree" id="cboThree" class="myCombos"></select> So I can obtain all three combos fairly simply by doing: $(".myCombos");
How to change (add) a DIV class on every input change?
I'm asking if is possible to change (add) dinamically a class to a DIV on input change/validation. Less say for example I have two classes: success and error. The HTML markup is basically this one: <div class="control-group"> <label class="control-label" for="inputFirstName">First Name: <span class="text-error">*</span></label> <div class="controls"> <input type="text" id="inputFirstName" placeholder="John"> </div> </div> So when I fill the input with some value (no matter if is right or not because
jquery autocomplete - pass just one value, not the entire array
I'm hoping someone can help me out with this, I'm relatively new to PHP as my background is ASP, so I'm a bit stuck. I'm using the following code as demonstrated here htmlblog.us/jquery-autocomplete ...and I've customized it (slightly) to pull information from my mysql database. Everything is working fine, however, my problem is that when the user selects a specific location from the drop down, its passing over the suburb, the state, and the postcode. I only want to pass over the postcode value,
Next Page