Get query string values from Javascript

So now I am writing here utility function that i am using to get query string values.

Just Passe the query string name and function will return value.


function queryString(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if (results == null) return "";
else { var x = results[1]; return x.replace(/%20/gi, ' '); }
}

Find Bootstrap screen size in Javascript

Some times we want to know bootstrap screen size from javascript. When I am developing I needed it and Now I am using following function. Calling it I can get bootstrap screen size like “xs”,”md”,”sm”,”lg”


function findBootstrapEnvironment() {
var envs = ['xs', 'sm', 'md', 'lg'];

$el = $('
<div>');
$el.appendTo($('body'));

for (var i = envs.length - 1; i >= 0; i--) {
var env = envs[i];

$el.addClass('hidden-' + env);
if ($el.is(':hidden')) {
$el.remove();
return env
}
};
}