[Solved] Has something changed in Javascript implementations recently (or is it me)?

No, this hasn’t changed (there’s something similar that’s changed, but not this; more below). Here’s the difference: If item isn’t declared, then you’ll get the error about item. If item is declared but has the value undefined, you’ll get the error about reading a property of undefined. This has always been the case. You mentioned … Read more

[Solved] how to add css on click and remove it when they click close button [closed]

HTML <button id=”start”>Start</button> <button id=”close”>Close</button> JS $(‘#start’).click(function () { $(this).addClass(‘start’); }); $(‘#close’).click(function () { $(‘#start’).removeClass(‘start’); }); CSS .start { // css style here } 7 solved how to add css on click and remove it when they click close button [closed]

[Solved] Javascript array arrange parent and child as array?

My working solution: let final = []; let sample = [ { tribe_id: 1, tribe_name: “Tribe A”, squad_id: 1, squad_name: “Squad A” }, { tribe_id: 1, tribe_name: “Tribe A”, squad_id: 2, squad_name: “Squad B” }, { tribe_id: 2, tribe_name: “Tribe B”, squad_id: 3, squad_name: “Squad C” } ]; console.log(sample); const uniqueTribes = sample.reduce((acc, current) => … Read more

[Solved] Can this Javascript function be re-written in jQuery? [closed]

I would have a js array of ids you are checking for, idToCheck = [‘id4735721’, ‘id4735722’, …]; Then compare them in a for loop. for(id in idToCheck){ if($(‘#’+idToCheck[id]).val() != ‘NEGATIVE’ || if($(‘#’+idToCheck[id]).val() != ‘NEGATIVE DILUTE’){ checkfinalpass=”No”; } } I didn’t redo your whole code but hopefully this will point you in the right direction. 2 … Read more

[Solved] String to arrays

“needs to be divided into multiple array after 5 comma seperated values” You seem to be saying that the result should be one array with five values in it and then a second array with the next five values in it, etc. If so, you can do the following: var list = “<%=ab%>”; list = … Read more

[Solved] I want to make my section(contents 1~4) swap when I click each navigation elements. [closed]

Yes you need JavaScript (other languages could do it, but it is the simplest I know) for example, you can change HTML to (slightly simplified for the sake of clarity): <!DOCTYPE html> <html> <meta charset=”utf-8″> <head> <link rel=”stylesheet” href=”https://stackoverflow.com/questions/29768056/./test.css”> <!– Must have this line first, to enable functions in test.js –> <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js”></script> <!– … Read more

[Solved] Change label text every two seconds and wait executing following cos [closed]

I’m not sure that I understood correctly.. Maybe you need something like this? function func_code() { var codes = “100000,100004,100007,100009,100012”; var code_arr = codes.split(‘,’); for (i = 0;i < code_arr.length;i++) { (function(i){ setTimeout(function(){ change_number(code_arr[i]); }, 2000*i); })(i) } } function change_number(i) { document.getElementById(‘counter’).innerHTML = i; } func_code(); <div id=”counter”></div> 3 solved Change label text every … Read more

[Solved] jQuery converted codes wont work [closed]

You’re not using the correct selectors. The original code has this: document.getElementById( ‘open-button’ ) Which identifies an element with the id “open-button”. The new code has this: open_menu = $( ‘.open-button’ ) Which identifies an element (or set of elements) with the class “open-button”. To use an id you need to use a #: open_menu … Read more

[Solved] I need a duration picker in javascript

For days field, just copy the format of other fields and update the value from 60 to 24. But as you mentioned about change values from keyboard, you should choose form events or keyboard events to do that. In this demo, I chose the blur event because it will trigger when the input loses focus. … Read more

[Solved] Please check jQuery syntax [closed]

The code is syntactically wrong as you you have mixed up the function ending braces. Below is the syntactically manipulated code. Hope you find that helpful. jQuery(document).ready(function ($) { var sliderHeight = $(window).height()-$(‘.slider’).position().top; $(‘.slider’).css({ ‘height’: sliderHeight }); $(‘.landing-title’).css({ ‘top’: $(‘.slider’).height()/2 – $(‘.landing-title’).height()/2 }) ; }); $(window).resize(function(){ sliderHeight = $(window).height()-$(‘.slider’).position().top; $(‘.slider’).css({ ‘height’: sliderHeight }); $(‘.landing-title’).css({ ‘top’: … Read more