【问题标题】:Button not working on mobile website - wordpress按钮在移动网站上不起作用 - wordpress
【发布时间】:2020-01-17 22:14:21
【问题描述】:

我不明白为什么这个按钮在移动设备上不起作用。我尝试了一些不同的东西,但似乎无法让它发挥作用。台式机上的一切都很好,但在移动设备上却不行(谷歌检查或实际的 iPhone)。使用 Wordpress。

// Starts the sequence from the GO button
function onSubmit() {
  inputHandler();
  findItem(input)
}
<button class="barItem" style="width: 40px" id="submit" onclick={onSubmit()}>GO</button>

也试过了

// Starts the sequence from the GO button
function onSubmit() {
  inputHandler();
  findItem(input);
}

// Starts the sequence when you press enter
document.getElementById('pNum').onkeydown = function(e) {
  if (e.keyCode == 13) {
    onSubmit();
  }
};
<input class="barItem" type="submit" onclick={onSubmit()} onsubmit={onSubmit()} value="GO" />

【问题讨论】:

  • 尝试在您的 onclick onclick="onSubmit()" 和 onsubmit onsubmit="onSubmit()" 上使用引号
  • {} 中的 onclick={onSubmit()} 是 Wordpress 语法吗?

标签: javascript jquery html css wordpress


【解决方案1】:

我相信正确的语法应该是 onclick="onsubmit()" 除非你使用某种框架

【讨论】:

    猜你喜欢
    • 2012-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多