JQuery使用筆記
阿新 • • 發佈:2017-10-31
data func nbsp .ajax urn inpu nsh innerhtml color
1.選擇器
id選擇器: $(‘#btnShow‘)
class選擇器: $(‘.banner‘)
tag選擇器: $(‘input‘)
2.常用方法
取 / 設value: $(‘#btnShow‘).val() / $(‘#btnShow‘).val(‘sss‘)
取 / 設text: $(‘#btnShow‘).text() / $(‘#btnShow‘).text(‘sss‘)
取 / 設innerHtml $(‘#btnShow‘).html() / $(‘#btnShow‘).html(‘sss‘)
取 / 設style $(‘#btnShow‘).css(‘color‘) / $(‘#btnShow‘).css(‘color‘, ‘red‘)
取 / 設attrbute $(‘#btnShow‘).attr(‘name‘) / $(‘#btnShow‘).attr(‘name‘, ‘sss‘)
3.ajax
$.get(url, function(returnData) {
//do something
});
$.post(url, {name:‘aaa‘, account: ‘hehe‘}, function(returnData) {
//do something
});
JQuery使用筆記