简体   繁体   English

为什么我的输入在移动设备上不起作用?

[英]Why does my input not work on mobile?

I am building a simple guessing game for a class I am taking, and I built it with Bootstrap and custom CSS and JavaScript. 我正在为要上的课程构建一个简单的猜谜游戏,并使用Bootstrap以及自定义CSS和JavaScript构建了它。 However, when I went to the webpage that is hosting the project on my iPhone 6S running iOS 9.2.1, the input where the user places their guess does not accept an argument. 但是,当我转到在运行iOS 9.2.1的iPhone 6S上托管项目的网页时,用户在其上输入猜测的输入不接受参数。 On desktop, the input works perfectly, and all of the other buttons work as expected on both desktop and mobile. 在台式机上,输入工作正常,其他所有按钮在台式机和移动设备上均正常工作。 Why might my input not work on my iPhone? 为什么我的输入不能在iPhone上使用?

<input class="btn btn-default btn-lg input" type="text" id="guess" placeholder="Pick a number between 1-100">

My guessing game link 我的猜谜游戏链接

Screenshot: The input doesn't accept anything I try to type 屏幕截图:输入不接受我尝试输入的任何内容

UPDATE: I found a question similar to mine at this link . 更新:我在此链接中发现了一个与我类似的问题。 However, after going through the Bootstrap CSS and deleting the elements the question deemed would solve my problem, the problem remains. 但是,在通过Bootstrap CSS并删除了认为可以解决我的问题的元素之后,问题仍然存在。

I had the same problem and after looking at Bootstrap "btn" styles I figured out that this style is breaking my input: 我遇到了同样的问题,查看了Bootstrap的“ btn”样式后,我发现这种样式破坏了我的输入:

.btn {
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

So I changed it to: 所以我将其更改为:

input.btn {
  -webkit-user-select: initial;
  -khtml-user-select: initial;
  -moz-user-select: initial;
  -ms-user-select: initial;
  user-select: initial;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM