Tagged Questions
0
votes
2answers
30 views
Execute private function inside the class by its name (string)
At the moment I have simple JavaScript class like this:
function MyClass() {
// ... some code ...
this.Create = function() {
funcName = 'myTestFunc()';
cTimer = setTimeout(funcName, 1000);
}
...
0
votes
3answers
69 views
Call function in javascript file from html onclick event
This has been driving me crazy- I can't figure out why it wont work!
I have two files: myPage.html and myCode.gs in google scripts. I have deployed the html file as a web app, and I want the onclick ...
-2
votes
1answer
58 views
javascript for loop not executing function until end of loop, then iterating function n number of times
I am attempting to load some div's with google map images from a loop that adds one to the value of a document.get. Problem is the getLocation() call comes at the final iteration of the loop, but ...
0
votes
4answers
49 views
Javascript: Combine function argument with string to reference var
I have vars that look like this:
var cardholder = $("#cardholder");
var cardholderInfo = $("#cardholder-Info");
And a function (which doesn't currently work) that looks like this:
function ...
1
vote
2answers
32 views
Define local function in JavaScript: use var or not?
When a local (inner) function is declared in JavaScript, there are two options:
Declaring with var keyword, assigning to the variable:
(function() {
var innerFunction1 = function() { ... };
...
0
votes
1answer
27 views
Want to pass a variable to node async's map method
I'm using node async, and I'd like to pass a variable to the method that it uses within the second parameter... e.g:
async.map(submissions, addScore, function(err, submissions) {
if ...
0
votes
2answers
34 views
jquery .on() executing function before event occurs
var MobileMenu = {
menu: function () {
$('#navigation').toggleClass("open");
$('body').toggleClass("push");
}
}
$(function(){
$(".icon-menu").on("click", ...
2
votes
2answers
34 views
keep image source changed with a function
For a tic tac toe game, I used the following code to change an image source to an 'x' or 'o':
var player = 1;
function changePicture(picture){
if(player === 1){
...
-2
votes
1answer
50 views
Javascript function always returns true?
I have this function which is a property of an object,
Layer.prototype.mouseInBounds = function() {
// Return value
var ret = true;
// Layer mouse co-ordinates are not valid
if ...
0
votes
4answers
28 views
Javascript form validation return
I am slightly new to javascript and I'm starting to understand how this coding mechanism works. I created a simple html form with a number of fields. I am using javascript to acquire the data from the ...
0
votes
2answers
32 views
Javascript function data outside of a function
I'm trying to create a simple javascript game and I'm running into a problem accessing a function's data outside of it.
This code works perfectly.
window.onload = function() {
var FPS = 30;
var ...
0
votes
1answer
16 views
DataTables mRender “object is not a function” error
I am using DataTables to create a table. After I init the table, I would like to change some settings that control how one of the columns is rendered, like so:
var st = ...
0
votes
3answers
48 views
Setting a constant in a javascript function [duplicate]
Take a look at this code:
var arr = new Array();
for (var i = 0; i < 10; i++) {
arr[i] = {
func:function() {
console.log(i);
}
}
}
arr[0].func();
I am ...
3
votes
3answers
70 views
Restart / Refresh Javascript Function or Timer
I have the following code on my website....
At the moment, when "Test 1" is clicked the animation starts. After that, when "Test 2" or "Test 3" is clicked the animation does not restart...
How would ...
0
votes
7answers
41 views
Solved…Jquery/javascript function issue
I have a javascript function doing some animation and its parameter is a parent selector.
function myFunction(a)
{
$("'"+a+">#one'").stop(true, true).animate({left:'30px'},1100);
...