All Questions
107
questions
0
votes
0
answers
35
views
How can I convert multiple similar instances of javascript into one global function?
On my music improvising website, I've created a list of rhythms that a user can choose from. When they click the button associated with each rhythm, two things happen: 1) the PNG of the rhythm fills ...
2
votes
3
answers
106
views
How do I change the value of the global "$" to a custom function that returns a jQuery instance?
Before I begin, I'd like to make it clear that I don't want to modify the jQuery library in any way, I just want to replace the value of the $ global with a custom function that returns a jQuery ...
-2
votes
3
answers
51
views
Unable to update global variable using javascript on button click
I need to update the price global variable. I believe it may have something to do with scope. I would appreciate it if you could be of assistance in this regard.
This is the script:
var price = 0;
...
0
votes
0
answers
74
views
Global variable's value is not changing after changing its value in function
<!DOCTYPE html>
<html>
<head>
<title>Gemoetry</title>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/...
0
votes
1
answer
738
views
How do I pass a variable from js file to an html page? [duplicate]
I have a webpage which utilizes javascript, and I have a .js file declared separately (I need it to be separately)
Here's what's in the code:
$(document).ready(function() {
$(document).on('click',...
0
votes
0
answers
2k
views
How to make a global function in JQuery?
I'm trying to offload common functions to a separate functions.js file in order to clean things up. I've managed success in making the global functions work, but there's some inconsistency in the way ...
0
votes
0
answers
80
views
Javascript / jQuery countdown expires globally in each country in its midnight
this is time when countdown should expire, just example:
var bigDay = new Date("15 Jan 2019, 23:59:59");
Rest of the countdown code is already done.
Consider this time as midnight. Does this mean ...
1
vote
1
answer
133
views
jQuery How do I make a function global? or Document level? [duplicate]
I'm new to jQuery and javascript. I'm trying out a few things here so let me explain what i have:
-I have several seperate .js files running code. I cannot get them to load BEFORE the code in index....
0
votes
1
answer
28
views
jQuery function won't read properties globally
I'm in the process of streamlining a lot of jQuery code, and the first thing I want to do is to set functions globally so they can be used and reused across the scope. One function is for setting ...
0
votes
0
answers
23
views
Pass object from js file to another js file - node js [duplicate]
I have a problem in my Node.js project.
I trying to return an object "jsonData" by calling a function from another function that located in different js file.
functions.js:
var request = require('...
0
votes
3
answers
121
views
JSON variable undefined when global
I want to make a variable "city" global and use it in other function. I am requesting a JSON data and it seems to work in this function
var city;
function conditions(data) {
var city = ...
0
votes
4
answers
2k
views
jQuery how to declare variable outisdie function and use in function
I need your help. I want to declare input field in variable outside function and the variable should work in function: for example
var name = $("#name").val();
function _testAlert()
{
alert(name)...
0
votes
2
answers
66
views
How can I call image from global js?
My global js here :
...\htdocs\mysystem\public\js\main.js
The code like this :
$(function(){
...
$('#loading').html('<img class="displayed" src="{{asset("img/loading.gif")}}">');
...
0
votes
2
answers
27
views
Access to Variable Outside of Function Logic
$(window).on("load resize", function () {
if ($(window).width() < 768) {
menuHeight = '0px';
contactHeight = '100%';
} else {
menuHeight = ($('#desktop-...
0
votes
2
answers
341
views
Trying to set dynamic JS variables in a function globally
I'm trying to set local storage values using dynamic variables from within a function what will be looped through. Basically i'm just trying to do this (which works but isn't dynamic):
localStorage....