-
Notifications
You must be signed in to change notification settings - Fork 0
/
input使用坑之小结.html
249 lines (170 loc) · 12.3 KB
/
input使用坑之小结.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>input使用坑之小结 | tracy木子</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="最近在项目中使用一个标签,input。
小小一个标签,平时知道他是干嘛用的,然后,居然问题挺多。
举个例子:
jq 或者 zepto 前提下
1&lt;input id="inputBox" type="text" value="" placeholder="请把光标聚焦到我..."&gt;
12$('#inputBox').focus(); // 告诉你,无效!!!!$('input')[0].">
<meta property="og:type" content="article">
<meta property="og:title" content="input使用坑之小结">
<meta property="og:url" content="http://tracylyx.github.io/input使用坑之小结.html">
<meta property="og:site_name" content="tracy木子">
<meta property="og:description" content="最近在项目中使用一个标签,input。
小小一个标签,平时知道他是干嘛用的,然后,居然问题挺多。
举个例子:
jq 或者 zepto 前提下
1&lt;input id="inputBox" type="text" value="" placeholder="请把光标聚焦到我..."&gt;
12$('#inputBox').focus(); // 告诉你,无效!!!!$('input')[0].">
<meta property="og:updated_time" content="2017-08-07T13:12:40.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="input使用坑之小结">
<meta name="twitter:description" content="最近在项目中使用一个标签,input。
小小一个标签,平时知道他是干嘛用的,然后,居然问题挺多。
举个例子:
jq 或者 zepto 前提下
1&lt;input id="inputBox" type="text" value="" placeholder="请把光标聚焦到我..."&gt;
12$('#inputBox').focus(); // 告诉你,无效!!!!$('input')[0].">
<link rel="alternate" href="/atom.xml" title="tracy木子" type="application/atom+xml">
<link rel="icon" href="/favicon.png">
<link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<div id="container">
<div id="wrap">
<header id="header">
<div id="banner"></div>
<div id="header-outer" class="outer">
<div id="header-title" class="inner">
<h1 id="logo-wrap">
<a href="/" id="logo">tracy木子</a>
</h1>
<h2 id="subtitle-wrap">
<a href="/" id="subtitle">博客小站</a>
</h2>
</div>
<div id="header-inner" class="inner">
<nav id="main-nav">
<a id="main-nav-toggle" class="nav-icon"></a>
<a class="main-nav-link" href="/">Home</a>
<a class="main-nav-link" href="/archives">Archives</a>
</nav>
<nav id="sub-nav">
<a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
<a id="nav-search-btn" class="nav-icon" title="Zoeken"></a>
</nav>
<div id="search-form-wrap">
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit"></button><input type="hidden" name="sitesearch" value="http://tracylyx.github.io"></form>
</div>
</div>
</div>
</header>
<div class="outer">
<section id="main"><article id="post-input使用坑之小结" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/input使用坑之小结.html" class="article-date">
<time datetime="2017-08-07T13:05:25.000Z" itemprop="datePublished">2017-08-07</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 class="article-title" itemprop="name">
input使用坑之小结
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>最近在项目中使用一个标签,input。</p>
<p>小小一个标签,平时知道他是干嘛用的,然后,居然问题挺多。</p>
<p>举个例子:</p>
<p>jq 或者 zepto 前提下</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="tag"><<span class="name">input</span> <span class="attr">id</span>=<span class="string">"inputBox"</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">value</span>=<span class="string">""</span> <span class="attr">placeholder</span>=<span class="string">"请把光标聚焦到我..."</span>></span></div></pre></td></tr></table></figure>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">$(<span class="string">'#inputBox'</span>).focus(); <span class="comment">// 告诉你,无效!!!!</span></div><div class="line">$(<span class="string">'input'</span>)[<span class="number">0</span>].focus(); <span class="comment">// 正常聚焦到此input身上</span></div></pre></td></tr></table></figure>
<p>丫丫的,真是傲娇啊!折腾了我一个晚上。算了,怪我太弱……</p>
</div>
<footer class="article-footer">
<a data-url="http://tracylyx.github.io/input使用坑之小结.html" data-id="cjishsrxo000h9zuj3dv2fq4n" class="article-share-link">Delen</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/html/">html</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/踩过的坑/">踩过的坑</a></li></ul>
</footer>
</div>
<nav id="article-nav">
<a href="/UML类图相关基础知识点.html" id="article-nav-newer" class="article-nav-link-wrap">
<strong class="article-nav-caption">Nieuwer</strong>
<div class="article-nav-title">
UML类图相关基础知识点
</div>
</a>
<a href="/冒冒失失.html" id="article-nav-older" class="article-nav-link-wrap">
<strong class="article-nav-caption">Ouder</strong>
<div class="article-nav-title">冒冒失失</div>
</a>
</nav>
</article>
</section>
<aside id="sidebar">
<div class="widget-wrap">
<h3 class="widget-title">Labels</h3>
<div class="widget">
<ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/ES6/">ES6</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ES6标准入门(第三版)/">ES6标准入门(第三版)</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JavaScript/">JavaScript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/React/">React</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ReactNative/">ReactNative</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Router/">Router</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/SEO/">SEO</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/canvas/">canvas</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/const/">const</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/css/">css</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gulp/">gulp</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/html/">html</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/let/">let</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mongoDB/">mongoDB</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/前端构建工具/">前端构建工具</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/叽叽喳喳/">叽叽喳喳</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/基础知识/">基础知识</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/类图/">类图</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/踩过的坑/">踩过的坑</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Tag Cloud</h3>
<div class="widget tagcloud">
<a href="/tags/ES6/" style="font-size: 10px;">ES6</a> <a href="/tags/ES6标准入门(第三版)/" style="font-size: 10px;">ES6标准入门(第三版)</a> <a href="/tags/JavaScript/" style="font-size: 10px;">JavaScript</a> <a href="/tags/React/" style="font-size: 20px;">React</a> <a href="/tags/ReactNative/" style="font-size: 10px;">ReactNative</a> <a href="/tags/Router/" style="font-size: 10px;">Router</a> <a href="/tags/SEO/" style="font-size: 10px;">SEO</a> <a href="/tags/canvas/" style="font-size: 10px;">canvas</a> <a href="/tags/const/" style="font-size: 10px;">const</a> <a href="/tags/css/" style="font-size: 10px;">css</a> <a href="/tags/gulp/" style="font-size: 10px;">gulp</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/html/" style="font-size: 20px;">html</a> <a href="/tags/javascript/" style="font-size: 20px;">javascript</a> <a href="/tags/let/" style="font-size: 10px;">let</a> <a href="/tags/mongoDB/" style="font-size: 10px;">mongoDB</a> <a href="/tags/前端构建工具/" style="font-size: 10px;">前端构建工具</a> <a href="/tags/叽叽喳喳/" style="font-size: 10px;">叽叽喳喳</a> <a href="/tags/基础知识/" style="font-size: 10px;">基础知识</a> <a href="/tags/类图/" style="font-size: 10px;">类图</a> <a href="/tags/踩过的坑/" style="font-size: 10px;">踩过的坑</a>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Archieven</h3>
<div class="widget">
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/06/">June 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/10/">October 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/08/">August 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/04/">April 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/12/">December 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/11/">November 2016</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Recente berichten</h3>
<div class="widget">
<ul>
<li>
<a href="/JS中的各种height、width.html">JS中的各种height、width</a>
</li>
<li>
<a href="/【笔记】let和const命令.html">【笔记】let和const命令</a>
</li>
<li>
<a href="/我需要给站点做SEO.html">我需要给站点做SEO</a>
</li>
<li>
<a href="/开发过程中遇到的坑坑洼洼.html">开发过程中遇到的坑坑洼洼</a>
</li>
<li>
<a href="/UML类图相关基础知识点.html">UML类图相关基础知识点</a>
</li>
</ul>
</div>
</div>
</aside>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info" class="inner">
© 2018 John Doe<br>
Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
</div>
</div>
</footer>
</div>
<nav id="mobile-nav">
<a href="/" class="mobile-nav-link">Home</a>
<a href="/archives" class="mobile-nav-link">Archives</a>
</nav>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script src="/js/script.js"></script>
</div>
</body>
</html>