When I turn on the inspector in Chrome things behave correctly. On mobile devices it does not work and when it does, it works incorrectly.
What could be the issue ?
What I am trying to do is append something to the DOM if the user chooses a certain item in the <select>
$(document).on("mousedown", ".select-request", function () {
// Get the value of the current selected item
requestOnSite = $(this).val();
//This is the sentence that will be applied to the label.
var sentence = "By checking this box, I am confirming that all 3rd party applied products, e.g. alarm contacts, belts for a motorized door, etc. will be removed prior to the service date and time.";
//If the variable equals this string than we should append the label and checkbox
if (requestOnSite === "Request On-Site Service") {
//check if checkbox already exists.
if ($('.additional-checkbox').length === 1) {
return;
}
//Go ahead and append the checkbox.
appendCheckBox(sentence);
}
});