[Solved] How to make scroll menu? [closed]

You hadn’t imported jQuery library. In online tesing environments, like JSFiddle and CodePen, adding <script src=”https://stackoverflow.com/questions/31142083/sth.js”></script> won’t work as they have separated HTML, JS and CSS into separate “consoles”. You have to use the menu to import external libraries. https://blog.codepen.io/documentation/editor/adding-external-resources/ Your edited CodePen // Create a clone of the menu, right next to original. $(‘.menu’).addClass(‘original’).clone().insertAfter(‘.menu’).addClass(‘cloned’).css(‘position’,’fixed’).css(‘top’,’0′).css(‘margin-top’,’0′).css(‘z-index’,’500′).removeClass(‘original’).hide(); … Read more

[Solved] How to create an array with counter?

You declare myElement, but it is just null. In your function, trying to set an index of a null variable will do nothing. Additionally, you should increment after using the value, otherwise you miss out on the 0th element. var myElement = []; var countElement = 0; function wikiParsed(langPrefixElement) { myElement[countElement++] = countElement; } wikiParsed(); … Read more

[Solved] Get function result instead of it body [closed]

Instead calc of following line $(‘#button’).click(function(){alert(calc);}) Use calc() as shown below $(‘#button’).click(function(){alert(calc());}) The difference between calc and calc() is When you write calc that time you are passing the function as a Parameter instead of it’s return value. This is useful when you are passing a function as a Callback to execute it later. But … Read more

[Solved] Multiple ajax calls in jquery

If the number of ajax calls made are constant,You can use the following logic COUNTER=5; function reduceCounter(){ COUNTER –; if(COUNTER == 0) { localStorage.Obj=JSON.stringify(Obj); location.href=”https://stackoverflow.com/questions/33031287/nextPage.html”; } In each of your ajax calls , call reduceCounter() at .always(); eg: $.ajax({ url: .. type: ‘GET’, dataType: ‘json’, }) .done(){… //set Obj }, .fail(){… },.always(){ reduceCounter(); } solved … Read more

[Solved] Changing background-color of fixed block at every new screen

You can change the background color of that fixed div by using the index or anchorLink option in fullpage.js. To change the css you can use onLeave() or afterLoad() method to call the function $(document).ready(function() { $(‘#fullpage’).fullpage({ onLeave: function(anchorLink, index) { //using index if (index == 1) { $(“.fixed”).css(“background-color”, “black”); } if (index == 2) … Read more

[Solved] for each element with this id jquery

Id should be unique, use a class instead. <input class=”path”/> <input class=”path”/> $(‘.path’).val(“123”); And when you are setting a common value by using a class selector, there is no need to iterate. solved for each element with this id jquery

[Solved] Get css class list from style tag

Below code helped me getting my requirement. var resultarray = []; var a = $(‘#pageStyleCss’).html(); if (a != undefined) { while (a.indexOf(‘{‘) != -1) { resultarray.push(a.substring(0, a.indexOf(‘{‘))); a = a.substring(a.indexOf(‘}’) + 1); } } var i, option = “<option value=””></option>” for (i = 0; i < resultarray.length; ++i) { if (resultarray[i].indexOf(‘.’) > -1) { option … Read more

[Solved] My Javascript not working?

There is an error in your developer console because as Ghostrydr says your syntax is wrong. You are missing a “.” before focusout like this: $(function(){ $(‘.inputForm .inputbox input’).focusout(function(){ var text_val = $(this).val(); if(text_val === “”) { $(this).removeClass(‘has-value’); } else { $(this).addClass(‘has-value’); } }); }); Fiddle: http://jsfiddle.net/7vmzzhea/18/ 1 solved My Javascript not working?