I'm a beginner to closures (and Javscript in general), and I can't find a satisfactory explanation as to what's going on in this code:
function myObject(){
this.myHello = "hello";
this.myMethod = do_stuff;
}
function do_stuff(){
var myThis = this;
$.get('http://example.com', function(){
alert(this.myHello);
...
Ok this question may sound a bit convoluted, or at least esoteric, but I'll try my best to elucidate.
In my charting application I have a div which is used as a popup tool tip. This tooltip appears when you hover over a datapoint and gives you some information. I used z-index to make the tooltip render above the underlying chart div. H...
Is there a project (open source) that takes the widgets and plugins for jQuery UI but allows us to use them without setting up any HTML?
Kinda like Ext-js and Sproutcore, but without the acidental complexity and lack of fluidity, and more like Cappuccino, but without requiring a Mac and the horrible load times from Objective-j (which al...
How do I maintain scope with this?
Original
var Base = new function() {
var canvas;
var context;
this.init = function()
{
console.log("Canvas: " + $("canvas")[0])
this.canvas = $("canvas")[0];
console.log("Context: " + this.canvas.getContext('2d'))
this.context = this.canvas.getContext...
For some reason the following code does not work as expected when in IE 8, as noted in the comment. I'm trying to add a "writeSpecial" method to the document object, and this works fine the first time that the method is called, but whenever this is called a subsequent time, it becomes undefined.
However, this only happens in IE when I ...
Google hasn't yielded satisfactory results. I'd appreciate it if people can provide some suggestions. Thanks.
...
for(var p = 0; p < xmls.length; p++) {
var feed = new google.feeds.Feed(xmls[p]);
feed.load(function(result) {
//code
In the above code, if I output p outside of the feed.load function, I correctly see that p iterates. However, if I output p inside that function (where I need to access it), It remains at 2 (which happens to be...
I'm using DevExpress ASPxGridView edit form, using default edit form. However when I open the edit form in IE6 and click "update" to insert the record, it causes a JavaScript error that says "type" is null or not an object". However it works fine in IE7. I am puzzled and unsure of how to resolve this. Code is below.
<dx:ASPxGridView ID=...
Is there ANY method to delay the loading of 3rd party JavaScript files until the rest of the page has finished loading?
...
I'm generating a multi-dimensional array in javascript that looks like this (this is the JSON representation of the javascript array, it's not in JSON format):
"100": {
"40": {
"subtotal": "24.99",
"turn-around": {
"0": "2-4 Business Days",
"1": "Next Business Day (Add $15.00)"
},
"shipping": {
"...
i am having a simple html text box what i want just as the user type something in it the text should be invisible but the text should be there
<html>
<head>
<title>My Page</title>
<script type="text/javascript">
function hide()
{
document.forms["text"].style.visibility = 'hidden';
}
</script>
</head>
<body>
<form name="myform">
<div al...
I am using jQuery UI to build tabs on my page. That works well until I add this following piece of code.
$(function () {
$('#tabs').children("div").each(function (index) {
$('#tabs').tabs('load', index);
});
});
I'm trying to preload the tabs. What is interesting, is that if i run this through Firebug and put a breakpo...
I used different methods including "onclick" and jquery.
http://sky-walker.net/temp/test.htm
On Safari (for Windows at least), the first click after a popup appears (alert, prompt or confirm) isn't handled by the popup... e.g. in my test trigger a popup then hover or click on the checkbox... the first click doesn't register with the "o...
Hi All,
I am developing the web based application which require to check size of any file before uploading it on server.
It would have been easy if there was any means by which web developer can check size of file at client side instead of checking at server side which could avoid unnecessary trip to server.
Is there any security conc...
I use drop down menu - that contain all tags- for select tags for a topic. so, I need after users select a first tag, new drop down menu appere , and so on.
...
I am using the Facebook JavaScript SDK. I am able to get the user's information using:
FB.api('/me', function(response) {
....
});
I get the user's friends using:
FB.api('/me/friends', function(response) {
...
}); //.. it only has two values name and id.
I want to get friends Date of birth and location. Is there a FB.api method...
Hello Guys,
am developing a balloon notifications for my social network. i came across this error when there's 2 or more notifications. i checked my json response on jsonlint.com i got error at line 6
JSON response:
{
"nid": "1101",
"img": "<img src=\".\/images\/icons\/he_wall_post_icon.png\">",
"notifier": "Sarah O...
this is my code that has geo-rss from google maps rss:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google AJAX Feed API - Simple ...
hello sir, i got a problem with setTimeout.. i dont know why this will not work..
$(document).ready(function(){
var counterNum = 0;
function tick()
{
addText(counterNum);
setTimeout('tick()',1000);
counterNum++;
}
function addText(strNum)
{
$("div.counter").empty();
$("div.counter").append(strNum);
}
}...
I have an input mask on my text box like
000,000,000.00
I have the following jQuery code to check the value of text box before submitting data.
var txt_box = $('#txt_box').attr('value');
if(txt_box <= 0 )
But now even if I didn't input any data, the box remains empty with only the input mask,
data is submitting.
...