Using jquery, how can I:
1- Have all checkboxes on a page turned checked on or off?
2- Loop through all the checkboxes on the page which are selected. I.e something like this
$(sel-cboxes).each(myFunction);
So myFunction would be called on each selected checkbox.
Thanks in advance!
...
I want to count how many checkboxes a user has selected. For example, from a group of 10 checkboxes if he selects 5, then I want to be able to count it. Using the line:
$(":checkbox:checked")
I can select all of the checked checkboxes, is there a way to get the count of all the elements that are returned by that statement as well?
...
Is there any simpler way to swap two elements in an array?
var a = list[x], b = list[y];
list[y] = a;
list[x] = b;
...
Sometimes I use:
window.frames[framename].location.href
..only to find firebug reporting window.frames[framename].location is null, why would this be?
...
indices[i:] = indices[i+1:] + indices[i:i+1]
Hope someone helps.
...
These days I find myself shifting out more and more work to the client side and hence my JS files tend to get bigger and bigger. I have come to the point where most HTML pages have half a dozen or more JS imports in the header and I realised that this is hurting loading times.
I have recently discovered this script which lets you downlo...
Hello,
I'm using a page unload trigger to warn the user of unsaved changes while leaving the page/closing the tab/etc... and this works fine.
//Exit event
if (!changes_saved) {
window.onbeforeunload = confirmExit;
}
function confirmExit()
{
return "Your changes will be lost if you leave this page!";
}
My problem is that the brows...
Hi there,
I have an iframe with id "appframe", the source is page.html and it's on the same server. I want to get the source of the page using jQuery.
alert($("#appframe").contents().find("html").html());
returns <head></head><body></body> even though the document does not contain those tags, it only contains "Default page" - any ide...
I was fixing up an extension that was written for Firefox 2 to work with Firefox 3. One of the changes was to use:
window.getBrowser().addEventListener("load", checkURL, true);
instead of going through just window.
The only problem is that the "load" event seems to occur more than once per page load. I have also tried listening for "D...
i am new at javascript. very new actually, this ought to be my first script.
can anyone explain to me how to make a transparent overlay over any specified fixed width region, say 700x300px.
...
I hope someone can help with this issue. I have a popup iframe using lytebox. I would like it that when i click a link in my iframe with the class "mylink" that it executes the ajax call and update a div in my main window with the id "mydiv".
I know how to do the onclick events and the ajax call but i do not know how to access the "mydiv...
Hi
I am trying to make use of JQuery and Fancybox. This is how it should be used: http://fancy.klade.lv/howto
However, I can not generate many ids for "a href" and I do not want to make many instances of fancybox ready. So I want to be able to use one fancy box instance for many hyperlinks that do the same thing.
Whenever any of thes...
Hi,
I'm trying to keep as much OO as possible, but ASP.NET AJAX seems to be doing something strange after returning from the server...
function Person( personId ) {
var id = personId;
var firstName;
var lastName;
this.initializeStep1 = function() {
PeopleServices.getFirstName(id, this.initializeStep2);
}
this.initializeStep2 = fu...
Hi.
Say I have an "abstract class" like this:
function AbstractClass() {
this.getImplementingName = function() {
return /* how do I get this? */;
}
}
and an implementation like
function ImplmentingClass() {
}
ImplmentingClass.prototype = new AbstractClass();
var impl = new ImplmentingClass()
var name = impl.getImp...
I have a form with a text area input. I'm using JQuery to submit the form via an AJAX request in order to update a database. My problem is that I'm having difficulty retrieving the data from the text area input. If the input has an id of "txtBody" I have tried:
var body = $("#txtBody").val(); // This adds 'undefined' to the database
v...
i am making a photo gallery script that involves displaying an image in fixed width/height box. now i want that image to display in its complete size. i mean, if the box is 700x300 px, the image should not resize to 700x300 but should display at its own full resolution. also if possible, can i somehow make it drag around in the box so th...
I'm attempting to make a very simple 2-person chatroom for my Django site. I'm learning AJAX to do this. I need parts of the web page to update without user interaction:
When User 1 sends a message, it should appear on User 2's screen
When User 1 logs off, his status should change to "offline" on User 2's screen
What is the simplest ...
Is there a way to make a div popup in the center of the page after 10 seconds after the page loads?
...
I'm having a problem with using server callbacks to webmethods within an object in javascript...
function myObject() {
this.hello = "hello";
var id = 1;
var name;
this.findName = function() {
alert(this.hello); //Displays "hello"
myServices.getName( id, this.sayHello );
}
this.sayHello...
I got this javascript code from off the internet. It's a script that changes a picture and it caption from the selection of an options drop down box. The script works fine. The only problem that I have is that the value in the option box can only be numbers. Is there anyway to tailor this whereas the value within the options parameter ca...