Im currently using the following code to append a div to the body:
$("body").append('<div class="tooltip" id="op" style="position: absolute; z-index: 999; height: 16px; width: 16px; top:70px"><span>Test</span></div>');
How could I do the same as above but without the use of jQuery
?
In pure Javascript it's going to be a little bit more verbose:
var div = document.createElement('div');
div.className = 'tooltip';
div.id = 'op';
div.style.cssText = 'position: absolute; z-index: 999; height: 16px; width: 16px; top:70px';
div.innerHTML = '<span>Test</span>';
document.body.appendChild(div);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments