I'm new in javascript and i don't exactly understand how to modify this code to style a div:
function getParameters() {
var searchString = document.getElementById('input1').value,
params = searchString.split("&"),
hash = {};
if (searchString == "") return {};
for (var i = 0; i < params.length; i++) {
var val = params[i].split("=");
hash[unescape(val[0])] = unescape(val[1]);
}
console.log(hash);
//return hash;
$.each(hash, function( color, background ) {
document.body.innerHTML += color + background ;
});
}
Have a look also here: escaped URL parameters statements if else switch