JQuery使用笔记

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

  });

 

posted on 2017-10-31 11:44  转身的猫  阅读(96)  评论(0编辑  收藏  举报

导航