Skip to content

Instantly share code, notes, and snippets.

View ReenaVerma's full-sized avatar
😃

Reena Verma ReenaVerma

😃
View GitHub Profile
const waitForElement = (className, callBack) => {
window.setTimeout(function(){
const element = document.querySelector(className);
if(element) {
callBack(className, element);
console.log("Element exists...");
} else {
waitForElement(className, callBack);
console.log("Wait for element...");
};
const getCookie = (c_name) => {
var i, x, y, ARRcookies = document.cookie.split(";");
for (i = 0; i < ARRcookies.length; i++) {
x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
x = x.replace(/^\s+|\s+$/g, "");
if (x == c_name) {
return unescape(y);
};
};
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body {
background-color: #00ffa5;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body {
background-color: #00ffa5;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<h1>Hello World</h1>