Add inline style using Javascript

Solution 1:

nFilter.style.width = '330px';
nFilter.style.float = 'left';

This should add an inline style to the element.

Solution 2:

You can do it directly on the style:

var nFilter = document.createElement('div');
nFilter.className = 'well';
nFilter.innerHTML = '<label>'+sSearchStr+'</label>';

// Css styling
nFilter.style.width = "330px";
nFilter.style.float = "left";

// or
nFilter.setAttribute("style", "width:330px;float:left;");

Solution 3:

Using jQuery :

$(nFilter).attr("style","whatever");

Otherwise :

nFilter.setAttribute("style", "whatever");

should work

Solution 4:

You can try with this

nFilter.style.cssText = 'width:330px;float:left;';

That should do it for you.