點擊聚焦并傳遞參數(shù),第二個文本框是綠色的,沒看到他添加的css樣式啊
<body>
? ? <h2>.focusin()方法</h2>
? ? <div class="left">
? ? ? ? <div class="aaron">
? ? ? ? ? ? 點擊聚焦:<input type="text" />
? ? ? ? </div>
? ? </div>
? ? <div class="right">
? ? ? ? <div class="aaron1">
? ? ? ? ? ? 點擊聚焦并傳遞參數(shù):<input type="text" />
? ? ? ? </div>
? ? </div>
? ? <script type="text/javascript">
? ? ? ? //input聚焦
? ? ? ? //給input元素增加一個邊框
? ? ? ? $("input:first").focusin(function() {
? ? ? ? ? ? ?$(this).css('border','2px solid red')
? ? ? ? })
? ? </script>
? ? <script type="text/javascript">
? ? ? ? //不同函數(shù)傳遞數(shù)據(jù)
? ? ? ? function fn(e) {
? ? ? ? ? ? ?$(this).val(e.data)
? ? ? ? }
? ? ? ? function a() {
? ? ? ? ? ? $("input:last").focusin('慕課網(wǎng)', fn)
? ? ? ? }
? ? ? ? a();
? ? </script>
</body>
</html>
2017-09-14
獲得焦點后用outline:none可以去掉默認的藍色邊框,寫在css中也行:input:focus
2017-09-14
有啊,我看到那個添加了樣式喲
2017-09-14
第二個有一點藍色的邊框是文本控件的默認樣式