Created
March 15, 2024 01:50
-
-
Save devstar0209/cb21df653368bb4dd8bee08a0c35f136 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var forms = document.querySelectorAll('.needs-validation') | |
// Loop over them and prevent submission | |
Array.prototype.slice.call(forms) | |
.forEach(function (form) { | |
form.addEventListener('submit', function (event) { | |
if (!form.checkValidity()) { | |
event.preventDefault() | |
event.stopPropagation() | |
} | |
form.classList.add('was-validated') | |
}, false) | |
}) | |
$('input[type="file"]').on('change', function() { | |
$(this).next().html($(this).val().split("\\").splice(-1,1)[0] || "Select file"); | |
}); | |
$('#copyCode').on('click', function() { | |
var text = $('#referralCode').text(); | |
navigator.clipboard.writeText(text); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment