Javascript form validation submit function is being called only once

So I have the jquery code here: $(function() { const $facesSelectorContainer = $(‘.faces-select’); if ($facesSelectorContainer) { // store some variables const $hiddenFacesSelector = $(‘.selection-wrapper-faces’), $facesButtons = $facesSelectorContainer.find(‘.faces-container’), $facesSelector = $hiddenFacesSelector.find(‘select’), $facesUpload = $(‘.faces-upload’), $facesUploadFields = $facesUpload.find(‘.face-upload-container’); // upload the number of faces upload inputs visible function updateFacesNumber(e) { const number = parseInt($facesSelector.val()); for(let i =…

Padding appears when I generate the same code from javascript

I have a simple stacked row class which shows the upper box and lower box without padding. <span id=”route” class=”small”> <div class=”row” style=”border-style:solid;”> <div class=”col-md-12 col-12″> <p>UpperBox</p> <p>UpperBox</p> <p>UpperBox</p> <p>UpperBox</p> </div> </div> <div class=”row” style=”border-style:solid;”> <div class=”col-md-12 col-12″> <p>LowereBox</p> <p>LowereBox</p> <p>LowereBox</p> </div> </div> </span> However when I put the same source code dynamically by javascript.…

What is the best way to show the ‘closest’ value based on a number in Javascript? (e.g. 1=Happy, 2=Sad, if 1.6, return Sad)

As the topic states what is the best way to show the closest value based on a number in javascript? Assume that ‘Glad’ is the same thing as ‘Happy’, and ‘Down’ is the same thing as ‘Sad’. I have the following code, but it just seems incredibly lengthy and gets bloated with more states (i.e.…