VKvijay khamitkarinsite02.in·Mar 26, 2023 · 1 min readJavaScript utility for daily work - part 2Adding multiple CSS styles to HTML elements using JavaScript const addStyles = (el, styles) => Object.assign(el.style, styles); addStyles(document.getElementById('my_id'), { background: 'red', color: '#ffff00', fontSize: '3rem' }); // before /...00
VKvijay khamitkarinsite02.in·Mar 16, 2023 · 1 min readTips for CRO developers-accessing the swiper.js elementHere is the trick to access the swiper.js element which is already present in the website and then modify it instead of creating new instance of swiper.js To get access the swiper js instance with the below line. var abc = document.querySelector(".sw...00
VKvijay khamitkarinsite02.in·Mar 15, 2023 · 2 min readTo pull data from the Data Layer using the GTM object command with JavascriptSometime, we need GTM object value to manipulate HTML DOM element as per DataLayer value loaded. Here is the trick to pull the data from the Data Layer object using Javascript We need to install Tag Assistant Legacy (by Google) extension for Chrome s...00
VKvijay khamitkarinsite02.in·Mar 14, 2023 · 1 min readError handling for Undefined and Undeclared in javascriptUndefined: It occurs when a variable has been declared but has not been assigned any value. var technology; // not assign any value console.log(technology) //undefined Using of typeof operator in javascript the error handling for undefined variati...00
VKvijay khamitkarinsite02.in·Jan 25, 2023 · 2 min readBrowser tab is active or inactive using javascriptObjective - To check whether the current browser tab is active or inactive using javascript Using Page Visibility API: This will work only when user switched to another tab/window document.hidden: When the page is focused, it returns false and when t...00