How to use window.location.replace in jquery or javascript

I have a website for which I have implemented livechat, when user clicks on livechat link it opens a new window that is fine. I want to do is when no operator is online then it should not open a new window when livechat link clicked instead it should redirect to the contact us page […]

How to get max and min dates from array using javascript/jquery?

i want to get the min and max date form a json array: my code $.getJSON(url, function (data) { var dates = Object.keys( data[‘data’][‘horodate’] ).map(function ( key ) { return data[‘data’][‘horodate’][key].replace(/\-/g,’/’ ) }); var min = new Date(Math.min.apply( null, dates )); var max = new Date(Math.max.apply( null, dates)); }); data array is: Array [ “2016/10/13 […]

How do I resolve the no-restricted-syntax from eslinter in JavaScript ?

I am using ESLint in my project and am using the airbnb style guide. The following piece of code in my program is giving me a linting issue. I am working on ES6. It’s telling me to avoid using for-in here. What would be a better alternative as per ES6 standards ? function solveRole (i18nData) […]

clone() is only running once

I’m trying to add multiple product categories when “Add product” is clicked. I want the new product select box to remove the previously selected product category. I have this working for the first time the button is clicked, but it won’t work a second or third time. Thanks for taking a look. JSFiddle HTML <div […]

How to convert strings of date ranges into usable JSON?

I am getting a bunch of date ranges from a Solr index, which comes to me in this format: [ “[2016-11-02 TO 2016-11-02]”, “[2016-11-16 TO 2016-11-16]”, “[2016-11-05 TO 2016-11-08]”, “[2016-11-09 TO 2016-11-09]”, “[2016-11-11 TO 2016-11-12]”, “[2016-11-10 TO 2016-11-10]” ] I guess this is some kind of standard syntax for Solr, but how can I convert […]

how do I hide an element in javascript if localstorage variable is true

I’m trying to hide a video when the page loads and keep the video shown after any link is pressed this is my current code var videoplayer = document.getElementById(“videoplayerlayer”); var links = document.getElementsByTagName(“a”); if(localStorage !== ‘undefined’) { console.log(“localStorage exists”) if(localStorage[“vv”] == false) { videoplayer.style.display = “none”; localStorage[“vv”] = false; } else { for( i=0; i<links.length; […]

Transfer list item data from one page to another

I am using ionic 2 and am trying to transfer data from one page to another. More specifically one list item on the first page(quickSearch) to another page(quickSearchDetail). I have a picture below to demonstrate this. When I click on a list it should transfer that data to the next page, however I am having […]

How to get a value with 2 decimals with toLocalString?

I want a number to be displayed as decimal with two digits behind the comma. In Addition the number need to be formated as local string. How can I achieve that? var initialValue = 3000; // shall be displayed as 3,000.00 or 3.000,00 initialValue.toLocalString(); //digits are missing initialValue.toFixed(2); // local format is missing

How to get a callback for css3 transition end?

I am trying the following but I get no callback at all $(“#panel”).addClass(“showPane”); $(“#close_wikipedia”).on(“click”, function() { $(“#panel”).addClass(“close_wiki”); }); if ($(“#panel”).hasClass(“close_wiki”)) { $(this).bind(“transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd”, function() { $(“#panel”).removeClass(“close_wiki showPane”); }); } #panel { position: fixed; background: #444; height: 100%; width: 50vw; right: -100vw; transition: right 0.4s ease-in-out; -o-transition: right 0.4s ease-in-out; -ms-transition: right 0.4s ease-in-out; […]

geocomplete with Vue js — location being erased

I’m trying to use jQuery geocomplete along with Vue.js to populate a form with geo data. My code contains this form: <form> <label for=”get-offer-location”>location: </label><input id=”get-offer-location” v-model=”newoffer.location” type=”text”/> <div style=”visibility:hidden”> <input name=”lat” type=”text” value=””/> <input name=”lng” type=”text” value=””/> </div> </form> After I click on a suggested location from the get-offer-location input, it looks like the […]