Comment Comment by szhu The safe, proper way to do this is both shorter and more readable!Both with jQuery: const $newdiv = $('<div>') .addClass(messageDivClass) .text(inputTextBox.value) .css({'opacity': '0.95'}); and without: const newdiv = document.createElement('div'); newdiv.classList.add(messageDivClass); newdiv.innerText = inputTextBox.value; newdiv.style.opacity = '0.95'; parent szhu 5 years ago
Both with jQuery:
and without: