Javascript createElement and add new attribute to it — May 31, 2018

Javascript createElement and add new attribute to it

var innerImage=document.createElement("img");
innerImage.setAttribute('anyAttribute', "somevalue");

above code will result in

img src="test.png" anyAttribute="somevalue"
jQuery Datatable column inline edit — April 25, 2018
Javascript createElement() — March 26, 2018
Ajax request returns 400 bad request — February 13, 2018
jQuery datatable add input to toolbar section — December 17, 2017
jquery Datatable table.columns is not a function —
javascript Get query string parameters — December 11, 2017

javascript Get query string parameters

Now there is super easy way to do this.

// Assuming "?post=1234&action=edit"
    var urlParams = new URLSearchParams(;
    console.log(urlParams.has('post')); // true or false
    console.log(urlParams.get('post')); // get the value of key (post)
    //if u have more than one query parameters with same key
    console.log(urlParams.getAll('action')); // ["edit"]
    console.log(urlParams.toString()); // "?post=1234&action=edit"
    urlParams.append('active', '1'); //append new key and value to query string

for more help read this article