Using a long setTimeout
i am trying to understand the setTimeout function... i want an ajax call to go out every 30 minutes but i want to understand the resources being spend while it runs in the background... so... 1. when a setTimeout runs does it use a lot of resrouces? 2. would those resources run on the server proccesor or the browser itself (user computer)? 3. is there a better way to tell jquery / javascript - wait for 30 minutes and why.
Dialog not centering
Hi Dialogs are supposed to center by default with just a width and height specified. A simple page only works in Chrome. In Firefox ... - the top position is zero. - when I move or resize the dialog, the top position = height * -1... so a negative height value and disappears. To fix this, I set the BODY element to a height: 100% and now the dialog works. Centers and I can move it around and resize with no issue. In IE, I'm still working on a solution. I tried debugging, but takes alot of time understanding
Review copies available for jQuery Hotshot
We have a few e-copies of Instant jQuery Hotshot (http://www.packtpub.com/jquery-hotshot/book) available for review. If interested, just drop a line in the comments 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) "jQuery Hotshot" takes a hands-on tutorial approach and gives a step-by-step walkthrough of 10 individual jQuery projects that each focus on producing a specific, real-world
Using code to click on mobile menu
I am using this code to work with mobile menu. $('ul.mobile_menu > li > a.hasChildren').not('.active').click(function () { if ($(this).attr('class') != 'active') { $('ul.mobile_menu li ul').slideUp(); $(this).next().slideToggle(); $('ul.mobile_menu li a').removeClass('active'); $(this).addClass('active'); } This works on the root and first level menu items. I am having problem with second and third level menu ites with mobile device. Any suggestion or can you post the fix.
next().prop('id') doesn't return value of dynamiclly added img in IE8 or IE10 in compatibility mode
Does anyone have a work around for getting the next item of a div that has images added to it dynamically in IE8 or IE10 in compatibility mode. The following code works in FF, Chrome, IE9 and IE10 but not in IE10 compatibility mode or in IE8. var _nxtItm = $("#" + imgID).next().prop("id").trim(); In those browsers it just returns a blank. Again, the images and parent divs are added to the page when $(document).ready is fired. Any help would be appreciated. Thanks
$.post done callback closure issue
function submitSurvey() { var reason = $("input:radio[name='reason']:checked"); var reasonVal = reason.val(); var reasonHelp = reason.attr('reasonHelp'); var url = $('#surveyForm').attr('action'); var posting = $.post(url, {reason: reasonVal}); posting.done(function(data) { alert('You selected: ' + reasonHelp); }); } The alert in posting.done doesnt have access to reasonHelp due to the closure (at least that's what Web Inspector is telling me).
Detecting when XHR request is complete via Google Chrome via jQuery
I have a very large shopping cart page that loads a lot of scripts onto the page initially and later. When the page loads, there is a select drop-down box where you can select an option to reorder the items on the page by price, or by name, etc... every time a drop-down change is made, an ajax request is called, and then reloads the projects back onto the page and re-sorts them. My question is how can I detect when then re-ordering is complete? or when XHR request through Google Chrome is complete,
Accessing across frames
I am using modifications to code that can be found at "http://www.mathachew.com/sandbox/collapsible-menu/". I have simplified it to use just the "slide" code and changed the names to reflect my own page. This part works fine. Now when I click a link in another frame I want it to expand one of the menus. Basically, I am developing an online book. The contents are in one frame, and pages of the book display in another frame. When I display the index, which will display in the pages frame, and
Insert new content in container div
How could I insert html content into a container div - and insert this content at a specific height (px) from the opening tag of the container? - I'm quite stuck on this one and need a solution. offset() could be useful except it measures down from the top of the document, not from the content div container. any way to apply offset() to a container like .content below. jQuery(function($) { var menuHeight = $('.dynamic-menu').height(); var offSet = $('.content').offset().top; var distance
Select background image with jQuery
I have the following CSS adding a background image to a series of list items each of which carry a unique id. .revolve { background: url(images/page_edit.png) 0 9px no-repeat #fff; } I am trying to add a class to the background image using jQuery. $("background-image","url(images/page_edit.png)").addClass("edit_tasks") So I can link to a page (passing id parameter) using click event $(".edit_tasks").click(function(){ categoryId = $(this).parent("li").attr("id"); window.location = 'tasksdisplayed.php?category_id='+categoryId
how to animate vertical menu on hover or on click
on hover i want to pop out that menu by increasing the width an d height of li ....but as i over that menu is going in the last and not getting animated plz suggest function justclick(e) { $("#" + prevClick).removeClass("active"); $("#" + e.id).animate({ width: "200px", height:"50px", fontSize: "24px", borderWidth: "5px" }, 1500,function() { $("#" + e.id).addClass("active"); } ); // $("#" + e.id).animate({opacity: 0.1}, 'slow', function() { //$("#" + e.id).addClass("active");
How to alert when change page if filled some field
I want to alert user if user already filled some field, just like facebook did, how to do that?
Loading page into div is too quick
Hi, I have problem with loading page into div element. All is working, only one problem is timing. My function: function changePage(Id){ $("#content-page").fadeOut(200); $("#content-page").load("content_page.php", {id: Id}, function(){ $("#content-page").fadeIn(200)}); }After I click in menu (onclick="changePage(this.id);"), element is not directly fades out, loads content and fades in. Element loads new content than fades out an fades in. Where is problem please?
calendar for mobile using jquery
Hi, I am new to jquery. I need a calendar for mobile using jquery. It should have day, week, month view. Thanks in advance.
Storing array of values in one variable
The is My Code in the attachement. I'm preparing a offline quiz system. This code shows multiple questions with there option field. Now in radio variable, currently it stores the option of question submitted by user who's name is q1. Since the name of every question set is dynamic,how can I store multiple values in radio variable ? Like option of q1, q2... and so on ...
How to display the particular tag in a file like description in the listview dynamically using jquery?
I'm trying to get the some data from file like some.txt. I want to display some data in that file like description under the each list in the listview. $(xml).find('section[order="' + order + '"] content').each(function () { var content = $(this).text(); var seq = order + '' + $(this).attr('order'); var file = $(this).attr('file'); $("#content").append('<li><a href="#" data-sequence="s' + seq + '" file="' + file + '">' + content + ' </a> </li> '); }); $("#content").listview('refresh'); });
Returning AJAX Data from Function?
I have the following function function getAllUsers() { // make ajax request $.ajax({ url: url, type: "GET" }); return data; // <---- i want to return data from ajax call } How in the world can i have my function return data from an ajax call asynchronously so that the above function can be used by a client/caller like so. var userArray = getAllUsers();
Putting data from a database into highcharts with $.getJSON
I'm having some problems with $.getJSON, I really need some help because I don't know how to solve the problem and I've been stuck here for days. This is the js file that should generate highcharts when selecting a select option in HTML: $(document).ready(function() { $("#paese").change(function(){ var seriesOptions = []; $.getJSON("prova.php", function(data) { seriesOptions = data; }); var chart1 = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'column', spacingLeft: 20, borderWidth:
How to reset select box after "selected" has been assign
Hello, Im trying to reset("selectedItem",0) on a dropbox that has had a "selected" attribute assigned to it.When I try to do the "selectedItem,0" property it does not reset the box. How do I do this? $("#s1tpid").prop('selectedIndex',0); $("#s1elem").prop('selectedIndex',0);
Enabling a checkbox when text inputs are not empty
I have some text inputs and one checkbox: <input type="text"> <input type="text"> <input type="text"> <input type="checkbox"> I want to disable the checkbox and enable it when all text inputs will be not empty. I have this code, but it doesn't work: $(document).ready(function () { var empty; $('input[type="checkbox"]').prop({ disabled: true }); $('input[type="text"]').keyup(function(){ $('input[type="text"]').each(function(){ if($(this).val().length
What happened to api.jquery.com/jsonp ?
I'm trying to search jQuery's documentation from a different domain with JSONP. api.jquery.com/jsonp/ used to be the page to do it but it's been removed. Please can someone tell me the new URL or has the service been removed? Thanks in advance.
creating data
i have data like blow var data=[{"name":"NICCA","data":1},{"name":"TCS","data":2},{"name":"SafeScrypt","data":0},{"name":"GNFC","data":0},{"name":"eMudra","data":0},{"name":"MTNL","data":0},{"name":"IDRBT","data":0}]) but i need to construct like blow data: [ ['NICCA', 2], ['TCS', 1], ['MTNL', 0], ['IDBRT', 0], ['eMudra', 0], ['GNFC', 1] ] how to do it . please help me out... Regards
Accessing newly added html elements as soon as they are created
Hello, Lets say I have this code: var x = "<div id='div1' />"; $("#main").html(x); then I presume that the following line risks failure because the browser might not have updated the dom just yet $("#div1").html("Hello World"); So - is the above line going to work in all browsers ? (like I said I suspect not) And if not, what event fires that I could pick up on to make the above line work ? I tried this $("#main").html(x).ready(function (h) {$("#div1").html("Hello World");}; BUT
Problem with trigger() in a loop
Hi all, I don't know if this question has been asked before. I have a loop and inside that loop I have a trigger and an event handler for the triggered event. <Code Snippet> $.each(loopvalue, function(k,v){ var element = $("#divid").find(k); element.trigger('dblclick'); element.dblclick(function(event){ //do something }); }); </Code Snippet> If loopvalue has one element, everything works fine perfectly. If loopvalue has more that one element then the first cycle
How to check select event
I have two options select, if I want to change option 1 to option 2, I want to show confirm message let user check, if no then keep on 1, if yes then change to 2, how to do that?
Building a browser extension for work .
Hi all, I'm working at a company as an intern and I'm hoping to put together a web application that would make life a bit easier for my team. Jquery seems like a way of doing this. I need to build an app that does the following steps on the company platform: 1. Look up a particular set of numbers. 2. Add those numbers together. 3. Look up a separate number 4. Divide the sum of the first set by the send number 5. Multiply the answer by 100. We currently have to do this manually across multiple
Hidding a div if certain conditions
I don't know if this is possible In most cases, my html would look like this: <div class="1"></div> <p class="1"></p> <p class="2"></p> <div class="2"></div> <p class="1"></p> <p class="2"></p> <div class="3"></div> <p class="1"></p> <p class="2"></p> But, if I had a scenario (depending on the data output) and my html looked like this: <div class="1"></div> <p class="1"></p> <p class="2"></p> <div class="2"></div> <div class="3"></div> <p class="1"></p> <p class="2"></p>how would I hide div class
Previous Ajax Call Interfering with New Ajax XML Call (update from previous post)
Sorry guys. Wish there was a way to delete my previous post. The issue all along was something else. However, it's a weird one. I'm getting a Firebug XML response error that reads: XML Parsing Error: not well-formed Location: moz-nullprincipal:{a258a2ce-874f-4563-8363-7286a3b56f82} Line Number 27, Column 29: ... pos = data.search(/<\/html><div id="old-posts">/); That's the code from my first .ajax() call when the page first loads and after the response is successful. How does ajax calls that's
Body content
Hi, I write this code, but does not work as I want. When you open a page you see only a logo in the middle of the screen and then dissapears slowly (is the part I write and it works), but then I want the index appears slowly, this is the part I can not do. I had prrobed with show() and append() but does not works as I expect. What I am doing wrong? Here is my code: <!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
help with toggleClass
I'm having a small bit of an issue with my toggle class, here is the script: $('.thecourse .category').click(function () { $(this).nextUntil('.category').slideToggle('normal'); return(false); }); $('.thecourse .categoryname').click(function () { $('span',this).toggleClass('arrow-down', 'arrow-up'); The HTML looks like this: <div class="thecourse"> <div class="category"> <div class="categoryname"> <span class="arrow-down"></span> </div> </div> </div> Now i did try to write in
Microsoft JET Database Engine error '80040e10' Parameter ? has no default value
Hi New to jQuery and trying to implement it on my site. I have an .asp site with a form attached to an Access Db. When trying to insert the form into the Db, the page halts on the #datepicker giving me this error message: Microsoft JET Database Engine error '80040e10' Parameter ?_13 has no default value. /asfalt_ny.asp, line 71 This is Parameter 13: MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param13", 202, 1, 50, Request.Form("datepickerU")) ' adVarWChar Head section: <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
code to capture first click of any field of the form
I have to fire below tracking; once on first click of any field of the form $(document).ready(function () { var s = s_gi(s_account); s.linkTrackVars = "None"; s.linkTrackEvents = "None"; s.trackDownloadLinks = false; s.trackExternalLinks = false; s.linkTrackVars = 'prop1,eVar1,events'; s.prop1 = s.eVar1 = 'Registration form'; s.linkTrackEvents = 'event1'; s.events = 'event1'; s.tl(this, 'o', s.prop1); }); So I want code to capture first click of any field of the form
jQuery2.0.2 Ajax loosing scope - Why?!
Folks, In my example below, an alert "1:emailaddress" is sent to the browser correctly, but "2:emailaddress" does not. Instead, firefox console tells me that data is undefined. Where am I going wrong? I am sure I could play with my ajax success data in this manner with jQuery 1.6, 1.7 and 1.8.... Anyone? (Help/pointers greatly appreciated) var request=$.ajax( { "type": "GET", "url": "/Dashboard/dashboard.php", "data": data, "cache": false }); request.done(function ( data ) { alert( "1:"+data[0].EmailAddress
Uncaught Error
Uncaught Error: Syntax error, unrecognized expression: #test + [id=[object Object]] someone can help me in this error? var selectedOption; if (specialisationId) { selectedOption = this.$('#test [id=' + specialisationId + ']'); } else { selectedOption = this.$('#test option:selected'); } console.log("selected option was " + selectedOption.text()) var selectedOptionText = selectedOption.text();
Jquery autoscroll offset from top of windows or tie to bottom of window
I'm a bit nooby about jquery and I need help with one practice I'm doing... I've made a autoscroll script with plugin ScrollTo and everything is working. It scrolls till the first class called in html. But I wanted to be rather showed on bottom of my window than on the peak top... I don't know how to solve it... Maybe 'faking' with somekind of offset from top?? Please help me.. I'm desperate... Here is my jsfiddle, and you can update it freely: http://jsfiddle.net/qgPch/1/
.ajax() Not Reading Returned XML Data
Hello everyone. The request is being made successfully to the server. The server is returning the xml data because I see it in Firebug. It returns a string that is a copy of the page and at the end it has my xml data. So the return info looks like this: <html> //copy of full page plus scripts </html><?xml version="1.0" encoding="utf-8"?><comments> (all of the xml data) </comments> Why it's returning a string, I'm not sure because I send the header info too in the php code: header('Content-Type:
Onkeyup function
Hi, I have been working on the following script: <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> </head> <body> <form name="contact" id="contactForm" method="post" action="count.php"> <label for="FNO">Enter First no:</label> <input type="text" name="FNO" id="FNO" value="" /> <label for="SNO">SNO:</label> <input type="text" name="SNO" id="SNO" value="" /> <input type="submit" name="submit"
Confused about what to include
I'm fairly new to jquery. I'm using the code shown below for a dialog. I found it on the web and it said to include <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> That works fine. But then I thought I should use a later version of jquery so I replaced the above with <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>That prevented the dialog from working at all. I found that if I included both of the above it will work.
Redirect to mobile website
Hi, I'm making a mobile website and to redirect to mobile version i used this code <script> if (document.location.search.indexOf("skipmobile") >= 0) { document.cookie = "skipmobile=1"; } else if ((document.location.hostname.match(/\.mobi$/) || screen.width < 699) && document.cookie.indexOf("skipmobile") == -1) { document.location = "mobile/"; } </script> but the problem is this when I access the website on mobile it does change the url to like this www.testsite.com/mobile/ path to the mobile site.
Enter key problem in text area, the value entered in text area along with enter key ????
Hi folks, After I "enter key" in textarea field and then save the form,when the same data is retrieved in popup window when we click on that window due to data consists "enter" key in between data...java script cant able populate the data(popup)?? how to resolve this ??one important point is we need allow user to press key!!!!
Next Page