You're warned: const messageText = inputTextBox.value.replace(/ ]+(>|$)/g, ""); var $newdiv = $(' ' + messageText + ' ').css({ 'opacity': '0.95' });
The safe, proper way to do this is both shorter and more readable! Both with jQuery: const $newdiv = $(' ') .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';
Unfortunately I'm quite new to full stack. ~1.5 months ago I didn't know a lick of HTML (let alone CSS, JS, any backend framework, AWS, etc), and I'm making lots of mistakes along the way. Currently trying to figure out how to improve my DB performance as Spring's default pagination seems to be quite slow and my site is getting hugged to death at the moment. If anyone has any tips for that especially I'm all ears.
At any rate, your suggestion seems easy enough to put in, so I'll put it in ASAP! Thanks again