Why does my code not work in Safari or Opera?

There is a function in js which displays messages to the table (messages are stored in json). In Google Chrome, it works, but Safari, Opera or Microsoft Edge - no! There is a mistake in code which is associated with the call to setTimeout (callback, ...
more »

2017-07-18 22:07 (2) Answers

hide element based on URL href

I need to hide an element based on the window.location.href object. My approach is below: $(document).ready(function() { var windowURL = window.location.href; if (windowURL.indexOf('stackoverflow') > -1) { $('#hide-this').css('dis...
more »

2017-07-18 16:07 (2) Answers

Randomly add class to two divs

I have a two column red/black grid 50/50% and height 100% and had a script to randomize the appearance of both when loading the page, so left or right. I changed the code behind the two column grid a bit going from relative position and float left of...
more »

2017-07-18 13:07 (3) Answers

How to separate an integer into two addends?

I need to separate an integer into two numbers. Something like dividing by two but I only want integer components as a result, such as: 6 = 3 and 3 7 = 4 and 3 I tried the following, but I'm not sure its the best solution. var number = 7; var pa...
more »

2017-07-18 12:07 (6) Answers

JavaScript : Sorting an array

Unsorted array [input] : ["> 30 days", "< 7 days", "< 30 days", "< 10 days"]; The format of an elements in array will always be like : </> X days Requirement : Above mentioned array should be sorted as per the greater then (>...
more »

2017-07-18 11:07 (3) Answers

Angularjs how to get filename extension?

Hi I am developing angularjs application. I am doing file upload module. I am trying to validate the files. I want to upload only xlsx or xls files. I have developed directive and factory method to upload files as below. myapp.directive('fileModel',...
more »

2017-07-18 10:07 (3) Answers

Outline not working properly on Firefox

I am trying to put some custom outline in order to reach some web accessibility suggestions. But I can't make with Firefox. This is how it looks on Chrome: And that icon is actually an anchor. On Firefox, it is only outlining the whole document,...
more »

2017-07-18 06:07 (0) Answers

$http not working in Angularjs 1.x

I am stuck with angular's all type of $http requests I am trying to hit the rest API with $http but my code ran through it and do not show any call in chrome network tab. I am using python simplehttpserver for my project execution. Below is the code...
more »

2017-07-17 22:07 (1) Answers

using JSON data in client side javascript file

Im fairly new to node.js and express. My question is how to correctly retrieve json data in a client side javascript file since im getting a 404 code about the .json file not being found. my file structure is a generic express structure and the .js...
more »

2017-07-17 22:07 (1) Answers

How to count visible 'li' on a search list

The code below is for a simple search. Im trying to count the visible 'li' on the list and display the total in a div "totalClasses". and then when the user search for a class update the total with only the visible classes(li). I have tried doing th...
more »

2017-07-17 21:07 (8) Answers

How to get the .index() of this.id

If I want to iterate through a class using each(). How can I get the id attached to that class and get it's index? I tried to do it like this but this.id only returns that id name and not the actual id: $('.nav-click').each(function() { console...
more »

2017-07-17 21:07 (2) Answers

Syntax of arrow functions

const fetch = url => dispatch => { // ... } export const fetchQuestions = tag => (dispatch) => { return dispatch(fetch(tag)); }; What is dispatch in the fetch function ? url is a first and single parameter fetch function. But what ...
more »

2017-07-17 16:07 (4) Answers

Dim entire screen except a fixed area?

I want to create a tutorial which will lead the user exactly where to click. I'm trying to cover the entire screen with a <div> which will dim all elements except a specific region which is in a fixed width, height, top and left. The problem i...
more »

2017-07-17 14:07 (6) Answers

Navigating Next and Prev Post By Label In Blogger

I wrote a code for navigating next and previous posts which are under the same label. My blog is http://www.rawdevart.com/ All the posts in this blog will always be under 1 label only. The blog is for a japanese comic (Manga) hosting, so the chapte...
more »

2017-07-17 09:07 (1) Answers