What is the best way to deallocate an array of array in javascript to make sure no memory leaks will happen?
var foo = new Array();
foo[0] = new Array();
foo[0][0] = 'bar0';
foo[0][1] = 'bar1';
foo[1] = new Array();
...
delete(foo)?
iterate through foo, delete(foo[index]) and delete(foo)?
1 and 2 give me the same result?
none?
...
As I'm writing JavaScript I'm always missing some fairly basic language features that JavaScript just don't have. So is there any library that would bring such features as trim, sprintf, str.endwith and etc. functions to JavaScript ?
I just have written those functions too many times and I'm also tired of copy/pasting them from my old...
Adding a validator to my form:
jQuery.validator.addMethod('whatever', function(val, el) {
// whatever goes here
}, 'A maximum of ' + $('#my_id_here').val() + ' categories can be selected.');
This doesn't fly. I always get undefined. Is this a good, simple way to do this?
Thanks
...
I'm wondering - is there any difference in performance of using CSS Transitions vs. any of the various JS animation libraries? (scriptaculous, scripty2, jsAnim, MooTools, $fx, etc, etc).
I've tried various tests in Safari / Google Chrome, and I don't actually see any difference -- I thought that CSS Transitions were supposed to be hard...
Hi
I noticed that jquery ajax request sometimes take about 1-2 seconds before the responce comes is this normal and is there any way to short that time to minimal?
The responce type is json and it's small html code.
Thanks!
...
So I'm using ExtJS for a job I'm working and I'm trying to dynamically populate the textarea associated with the HTML editor with data based on what a user selects from a combo box. From what I've found, I can load the HTML editor with text using the defaultValue property. So if I'm going to populate it after the page loads, can I give i...
Hi guys,
I have noticed that in most google maps you can not drag the marker icon into your address bar and see or download the icon .png file itself. Rather then you hover your cursor over the marker, you can see javascript:void(0).
How is that achieved? Thanks!
...
What is the best practice for that then?
Jslint explains that it "adds confusion". I don't see it really...
EDIT: The code, as requested:
var all,l,elements,e;
all = inElement.getElementsByTagName('*');
l = all.length;
elements = [];
for (e = 0; e < l; (e++))
{
if (findIn)
{
if (all[e].className.indexOf(cla...
It seems that IE8 defers javascript, but also doesn't block. I've setup a test environment to prove this. Here's the html page(replace 192.168.1.xxx with your server):
<html>
<head>
<title>IE Pains</title>
<script type='text/javascript' src='http://192.168.1.xxx/ietest/js.js'></script>
<script type='text/javascript'>
screa...
Is it possible to configure jrails so that it only replaces the ruby on rails helper methods for some parts of the site?
I am currently in a project where we are doing a staggered migration to jQuery so the site wide choice is not an option in this case.
...
I am wondering what this technique is called and what it does. It seems to be validating some regular expression on the variable url. I am customizing another persons code:
var url = document.getElementById("editorURL").value;
if(/(file|http).*/.test(url)) {
}
Maybe someone has a link to an article that explains this a bit more in...
Trying to find a way to trim spaces from the start and end of the string. I was using this, but it dont seem to be working:
title = title.replace(/(^[\s]+|[\s]+$)/g, '');
Any ideas?
...
I am wanting to test a web application which uses FCKeditor in Selenium IDE. Unfortunately, FCKeditor uses iframes, which are difficult to test in Selenium IDE. Basically, all I want to do is set the value of the FCKeditor editing area and read it later to see if the value was submitted correctly.
I suppose this question is two-fold: ...
I need to calculate the offsetRight of a DOM object. I already have some rather simple code for getting the offsetLeft, but there is no javascript offsetRight property. If I add the offsetLeft and offsetWidth, will that work? Or is there a better way?
function getOffsetLeft(obj)
{
if(obj == null)
return 0;
var offsetLeft...
I have a lite-javascript run image gallery. The javascript grabs each <img> element in the list and places it as a background in the parent <li> element. Then the CSS styles the thumbnails as small blocks with a defined height/width. A click-event for each <li> object toggles its child’s <img> element’s visibility and adds an “active” c...
Hi Folks,
I've scanned trough the documentation but I can't find out how I to get the field to get the datepickers value AND let it be editable using my keyboard numpad. So filling/editing the date without using the datepicker.
I hope my question is clear cause I don't know how the formulate it otherwise..
Greetings
...
I have a custom list in SharePoint, and I want to override the OK/Cancel buttons that are in the New Item form (The form displayed when you click "New" in the default view of the list).
I want the saving logic to remain intact, but I just want to change the default page it redirects to, ideally, to a whole separate page on the site that...
Hi, i have a form(id="search_options") and i tracking changes in form by:
$("#search_options").change(function() {
// Bla Bla Bla
});
In this form i have many inputs and one of is select(id="project_category") and i want to catch if user changed project_category select or another input. How can i done this ? Thanks
...
any ideas how to get client/request timezone in jsp?
...
I would like to POST a form in an iframe, generated like so:
My JS loads an iframe inside the page, adds a form to the iframe and submits the form. What I would like to happen is the iframe to load the result of that request. So, I would effectively like to post a form and render the result inside the iframe, without touching the parent...