hello.js

var please = require('share');
console.log('thank you');

NEW !!!

Friday, 29 January, 2016 UTC

Javascript – img onload examples

Sometime we need to call a function after an image has been loaded. We can attach onload even handler on image either in html itself read more The post Javascript – img onload examples appeared first on InfoHeap. ... more


Friday, 29 January, 2016 UTC

Multiple onload handlers using vanilla Javascipt

Attaching a function to windows on load event can be done in multiple ways using plain vanilla Javascript. One option is to use wondow.onload where read more The post Multiple onload handlers using vanilla Javascipt appeared first on InfoHeap. ... more


Thursday, 28 January, 2016 UTC

Javascript – use querySelector to set dom element html

Javascript querySelector can be used to select and set html of a dom element using css selectors. This can be done with jQuery also. But read more The post Javascript – use querySelector to set dom element html appeared first on InfoHeap. ... more


Monday, 25 January, 2016 UTC

AngularJS hello world example

Angularjs is a web application framework which has gained lot of popularity in mobile and single page applications. It uses directive ng-app to represent root read more The post AngularJS hello world example appeared first on InfoHeap. ... more


Saturday, 23 January, 2016 UTC

Selenium Phantomjs – check browser errors using pytest

Checking browser errors (including Javascript errors) is an important use case in testing a website. Javascript errors are hard to QA and can cause bad read more The post Selenium Phantomjs – check browser errors using pytest appeared first on InfoHeap. ... more


Saturday, 23 January, 2016 UTC

Python selenium – print browser log (including javascript errors) with phantomjs

It is useful to find out javascript errors in a page automatically. This can help in site quality test automation. Here is selenium code snippet read more The post Python selenium – print browser log (including javascript errors) with phantomjs appeared ... more


Thursday, 21 January, 2016 UTC

Python selenium – print javascript errors example with phantomjs

It is useful to find out javascript errors in a page automatically. This can help in site quality test automation. Here is selenium code snippet read more The post Python selenium – print javascript errors example with phantomjs appeared first on InfoHeap. ... more


Monday, 18 January, 2016 UTC

jQuery – find total number of DOM elements

To get total DOM elements including children use the following code (this includes root html element also) $('*').length To get all DOM elements in body read more The post jQuery – find total number of DOM elements appeared first on InfoHeap. ... more


Sunday, 17 January, 2016 UTC

How to remove jquery-migrate.js from wordpress

In case you want to remove jquery-migrate.js for performance reasons, here is the code you can use. Note that this may break some plugins or read more The post How to remove jquery-migrate.js from wordpress appeared first on InfoHeap. ... more


Wednesday, 6 January, 2016 UTC

document querySelector examples

Javascript querySelector() and querySelectorAll() can be used to get DOM element based on given CSS selector. These works on document and element objects both. querySelector() read more The post document querySelector examples appeared first on InfoHeap. ... more


Tuesday, 29 December, 2015 UTC

How to display auto fade out message using jQuery

Sometimes we need to display a message and then fade it out. jQuery fadeOut will make an element fadeOut (by animating css property opacity) will read more The post How to display auto fade out message using jQuery appeared first on InfoHeap. ... more


Monday, 28 December, 2015 UTC

Javascript – catch errors using window.onerror

Javascript errors can be caught using window.onerror event handler. Whenever a javascript error occurs browser calls this function. In this tutorial we’ll write error handler read more The post Javascript – catch errors using window.onerror appeared ... more


Saturday, 26 December, 2015 UTC

NodeJS – npm beginner tutorial

Install a package locally This is default option (no -g flag) $ npm install jslint Install a package globally $ sudo npm uninstall -g jslint read more The post NodeJS – npm beginner tutorial appeared first on InfoHeap. ... more


Thursday, 24 December, 2015 UTC

Python selenium – execute javascript code

Selenium code in python can execute custom Javascript and also return values from webdriver (PhantomJS, Firefox, Chrome. etc.) context. Here is sample code which counts read more The post Python selenium – execute javascript code appeared first on InfoHeap. ... more


Tuesday, 22 December, 2015 UTC

How to install node.js on Ubuntu Linux

Update node source $ curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - Check which nodejs will be installed $ apt-cache policy nodejs nodejs: Installed: (none) read more The post How to install node.js on Ubuntu Linux appeared first on InfoHeap. ... more


Monday, 14 December, 2015 UTC

Javascript – dump all handlers on window object

DOM window object has many javascript event handlers attached to it. It may be handy to dump and view all of these. Here is code read more The post Javascript – dump all handlers on window object appeared first on InfoHeap. ... more


Saturday, 12 December, 2015 UTC

HTML table with alternate color rows

We often need to display a table with alternate rows having different colors. We can do it either using CSS3 nth-child selector or using jQuery. read more The post HTML table with alternate color rows appeared first on InfoHeap. ... more


Friday, 11 December, 2015 UTC

Jquery – change table cells color based on value

It is sometimes useful to change color of table cells based on values for better presentation and readability. Here is quick code snippet to do read more The post Jquery – change table cells color based on value appeared first on InfoHeap. ... more


Monday, 7 December, 2015 UTC

How to print javascript object to log

Often we need to print a javascript object to console log or somewhere else for debugging purpose. These are some handy ways to dump javascript read more The post How to print javascript object to log appeared first on InfoHeap. ... more


Monday, 7 December, 2015 UTC

Javascript code snippets

The post Javascript code snippets appeared first on InfoHeap. ... more


Tuesday, 1 December, 2015 UTC

jQuery – difference between html() and text()

Jquery can be used to set content on and element (div, etc.) using text() and html() methods. Methods text(content) will first convert the content using read more The post jQuery – difference between html() and text() appeared first on InfoHeap. ... more


Monday, 30 November, 2015 UTC

jQuery – make a div stick at top on scroll

Find initial position of div box var boxInitialTop = $('#stickybox').offset().top; Attach handler to scroll event $(window).scroll(function () { if ($(window).scrollTop() > boxInitialTop) { // Box's read more The post jQuery – make a div stick at ... more


Monday, 30 November, 2015 UTC

jQuery – check if an element exists

jQuery when used with selectors like element tag, class, id can potentially return a jQuery object with no element in it. Since jQuery contains number read more The post jQuery – check if an element exists appeared first on InfoHeap. ... more


Sunday, 22 November, 2015 UTC

Debug javascript using node-inspector, node-debug, nodemon and Chrome

In case you are using node to run javascript on command line, you can use Chrome to debug javascript. It support GUI debugger functionalities like read more The post Debug javascript using node-inspector, node-debug, nodemon and Chrome appeared first ... more