限时免费试用:欢迎注册 api.bigmodel.org ,快速体验大模型 API 接入服务。
当前位置:首页 >前端技术 >JQuery/js

jq学习笔记(一)基础

分类:JQuery/js时间:2018-04-29浏览:2442
$(function(){
alert($)  //返回jq对象
alert($())  //返回jq对象
alert($('#box'))  //返回jq对象
alert($('#box').css('color','red'))  //返回jq对象

});
加载模式
$(document).ready(function(){
});
简写形式:
$(function(){
});
对象互换(jq ------ dom)
$(function(){
alert($('#box'))  //返回jq对象
alert(document.getElementByld('box'));   //返回原生dom对象
alert($('#box'.get(0)))  ////返回原生dom对象      get(节点号)
});

选择器

$("div").css("color","red")
$('a[title=num]').css("color","red")

过滤选择器

alert($('.red').is(function(){
    return $(this).attr('title')=='标题';
}));
本站文章如未注明出处均为原创,转载请注明出处,如有侵权请邮件联系站长。
0/500
Share your thoughts respectfully.