All Questions
Tagged with switch-statement jquery
312
questions
0
votes
0
answers
120
views
How I can dynamically add HTML with if /else or swtich/case conditions
What I'm trying to do :
I want to create an html code generator. The idea is to be able to create an email skeleton, with the possibility for the user, via inputs, to modify certain data, such as the ...
-1
votes
1
answer
41
views
Javscript Switch expression - How can it be made case insensitive?
I have two geojson files with the same key/labels but have different cases:
feature.properties.STATUS and feature.properties.status
I wish to test both file's label's values with a single switch ...
0
votes
0
answers
224
views
Switch Statement Keeps Returning Undefined
I'm fairly new to switch statements in general but please could anyone let me know why my switch statement here is returning undefined? I feel like i've looked at this code for way too long and need ...
0
votes
1
answer
28
views
Loop is not working in this switch case jquery
Loop is not initiating in this code and also split_value doesn't store any value. I want to compare dropdown value and excel data and then matched value should store in sum = [].
if (items) {
switch ...
1
vote
1
answer
73
views
How to store the user input throughout the site and on reload ( switch between dark and light theme )
I am basically setting up a dark mode switch to my site and I want the browser to remember user click from dark to light theme. Code somewhat breakup and not clean but anyhow it works in changing dark ...
0
votes
0
answers
164
views
How to use same javascript for multiple audio files on page?
I'm having trouble duplicating this code on my page to work for several different audio file players. Is there a way to dynamically switch out the audio depending on which audio player I'm interacting ...
0
votes
1
answer
130
views
Jquery Script Blocking Keyboard Input in Form Fill
Earlier, I was testing an online form on a project I am working on and noticed I couldn't actually type anything in any of the form fields. I narrowed it down to a specific script. And I think it's ...
0
votes
2
answers
44
views
Selecting a DIV ID that is Currently Visible and Storing in a Variable
How would you select the very first child of a parent ID that is currently visible and store it into a variable?
I've listed sample code below. Which is a series of content that fades in and out when ...
0
votes
1
answer
265
views
Switch Case with If Statements - Javascript & Jquery
What's wrong with this code? It's supposed to capture all clicks within #ts_container div that are either buttons or anchors. It is also supposed to capture keypress events.
I'm trying to apply an If ...
-1
votes
1
answer
240
views
Change if else to switch case statement
I have a function with some if…else like this:
function updateInputs(data) {
from = data.from;
to = data.to;
rangeInput = $(data.input);
if (rangeInput.hasClass('rangeSalary')) {
$...
1
vote
1
answer
51
views
JQuery switch lagging one click behind variable the switch is based on (when retrieving from PHP file)
I have the below code, which increases a 'week' variable on the click of an arrow.
It then uses the week variable to retrieve information from a PHP file (relevant to that week),
The 'week' variable ...
0
votes
3
answers
1k
views
Can a "case" in "switch-case" javascript ignore errors and run "default" if one of "case" an error occurred?
In this case, I want to a case in switch-case ignore anything errors and run a default, in one of the cases, I find a file JSON and want to convert to Object and inside that file JSON has lack syntax ,...
0
votes
1
answer
35
views
How best to render html using javascript based on json from server?
My server sends json (note the DISPLAY_CHECKBOX var)
{"MY_DATA":[{"ID":270336,"STATUS":"live","STATUS_DISPLAY_ORDER":6,"DISPLAY_CHECKBOX":0},{"ID":224808,"STATUS":"archived","STATUS_DISPLAY_ORDER":1,"...
1
vote
2
answers
267
views
Can "onClick" events in HTML pages change variables on a JS page?
I have 3 buttons on an HTML page and I want them each to change a variable, defined in my scripts.js, to a designated variable when they are clicked. The variable will then trigger a switch statement ...
0
votes
1
answer
150
views
jQuery select:option why when I choice option one to show specific field but instead it open all fields?
What I doing wrong ? Is there solution when I choice one specific option it only opens that specific field not all at same time ? My only solution is add DRY code
HTML
<select type="type-...