jQuery 一些操作
生活随笔
收集整理的這篇文章主要介紹了
jQuery 一些操作
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
?
1.監(jiān)聽(tīng)輸入框輸入
$("#email").bind("input propertychange change", function (event) { console.log($("#email").val()) });2.獲取輸入框內(nèi)容
$(" #test ").val()$(" input[ name='test' ] ").val()$(" input[ type='text' ] ").val() $(" input[ type='text' ]").attr("value")3.輸入框獲取焦點(diǎn)
$('#email').focus(function(){})3.輸入框失去焦點(diǎn)
$('#email').blur(function(){})4.設(shè)置樣式
$('#email').css({"border-bottom": "1px solid #ddd"});多個(gè)用逗號(hào),隔開(kāi)5.添加class屬性
$(".btn").addClass("animated tada");6移除class類名
$(".btn").removeClass("animated tada");7.點(diǎn)擊事件
$('.btn').click(function () {console.log(' $('#email').val()', $('#email').val()); })轉(zhuǎn)載于:https://www.cnblogs.com/karry990921/p/9058566.html
總結(jié)
以上是生活随笔為你收集整理的jQuery 一些操作的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 面向对象的数据存储方式
- 下一篇: 一个edit的学习笔记