[Solved] How do I change my JavaScript to run on page load instead of event change
You have non-unique ID’s for elements – jQuery will not work. Change ID to class. Also remove any reference to event (since there is no such thing on DOM ready). I have converted your JS code to actual jQuery: $(document).ready(function() { $(‘.numberofdaysperchosenfrequency’).each(hideDays); $(‘.numberofdaysperchosenfrequency’).on(‘change’, hideDays); }); function hideDays() { let parent = $(this).parent(); parent.find(‘.daycol’).show(); parent .find(`.daycol:not([data-id=”${$(this).val()}”])`) … Read more