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

  });

原文地址:https://www.cnblogs.com/gz-fenglang/p/7760755.html