单击按钮时重新加载页面Javascript、HTML
单击按钮时出现问题。我的页面重新加载,消息“MERCI,VEUILLEZ VÉRIFIER VOS MESSAGES”不显示。我不知道这两个问题是否有联系。我在Wordpress、Chrome和DIVI主题上。我在控制台中没有错误 HTML:单击按钮时重新加载页面Javascript、HTML,javascript,html,wordpress,function,button,Javascript,Html,Wordpress,Function,Button,单击按钮时出现问题。我的页面重新加载,消息“MERCI,VEUILLEZ VÉRIFIER VOS MESSAGES”不显示。我不知道这两个问题是否有联系。我在Wordpress、Chrome和DIVI主题上。我在控制台中没有错误 HTML: 特使> JavaScript: var button = document.getElementById('buttonsms'); if(button){ button.addEventListener('click', function(e)
特使>
JavaScript:
var button = document.getElementById('buttonsms');
if(button){
button.addEventListener('click', function(e) {
e.preventDefault();
this.classList.add('is-done');
setTimeout(function() {
button.innerHTML = "MERCI, VEUILLEZ VÉRIFIER VOS MESSAGES easy, set the button attribute to be onmousedown="location.reload();"When I replace the HTML by
<form class="formnumber">
<input class="inputsms" id="number" placeholder="ENTREZ VOTRE NUMÉRO" /> </form>
<button class="buttonsms" id="buttonsms">ENVOYER ></button>
var-button=document.getElementById('buttonsms');
如果(按钮){
按钮。addEventListener('click',函数(e){
e、 预防默认值();
this.classList.add('is-done');
setTimeout(函数(){
button.innerHTML=“MERCI,VEUILLEZ VÉRIFIER VOS MESSAGES简单,当我用替换HTML时,将按钮属性设置为onmousedown=“location.reload();”
特使>
替换前的动画和样式:
替换后的动画和样式:
完整的html看起来像是重新加载,以使消息弹出。在onmousedown属性中调用另一个函数,提醒用户您的消息。例如:在函数看起来像的地方重新加载alertUser(){alert(“message your want here”);}这有帮助吗?在你的代码中,它看起来像是带有上面提到的javascript函数的ENVOYER>,在标记中。你能告诉我在我的代码中放在哪里吗?我把它放在HTML中,像这样:ENVOYER>,但不工作:)
var button = document.getElementById('buttonsms');
if(button){
button.addEventListener('click', function(e) {
e.preventDefault();
this.classList.add('is-done');
setTimeout(function() {
button.innerHTML = "MERCI, VEUILLEZ VÉRIFIER VOS MESSAGES easy, set the button attribute to be onmousedown="location.reload();"When I replace the HTML by
<form class="formnumber">
<input class="inputsms" id="number" placeholder="ENTREZ VOTRE NUMÉRO" /> </form>
<button class="buttonsms" id="buttonsms">ENVOYER ></button>