I am trying to add some form elements dynamically via Ajax with jQuery. I want to make sure that I don\'t create the same element twice, so I only want to add it if it hasn\
(()=> { var elem = document.querySelector('.elem'); ( (elem) ? console.log(elem+' was found.') : console.log('not found') ) })();
If it exists, it spits out the specified element as a DOM object. With JQuery $('.elem') it only tells you that it's an object if found but not which.
$('.elem')