0 votes
1 view
in Web Technology by (6.8k points)

I am attempting to add this code to a dynamically created div element

style = "width:330px;float:left;"

This code creates the dynamic div

var nFilter = document.createElement('div');

nFilter.className = 'well';

nFilter.innerHTML = '<label>' + sSearchStr + '</label>';

I want to add the style after <div class=”well” but I do not know how to do it. Can someone help me with this?

1 Answer

0 votes
by (13k points)

You can use:
 

nFilter.style.width = '330px';

nFilter.style.float = 'left';

This would add an inline style to the element.

Want to learn Full Stack Development? Check out the Full Stack Developer course from Intellipaat.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...