https://github.com/hellokaton/mini-jq
🍣 mininal jquery, you don't need jquery!
https://github.com/hellokaton/mini-jq
ajax dom jquery minimal
Last synced: 11 months ago
JSON representation
🍣 mininal jquery, you don't need jquery!
- Host: GitHub
- URL: https://github.com/hellokaton/mini-jq
- Owner: hellokaton
- License: mit
- Created: 2017-05-27T14:47:49.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-30T14:13:03.000Z (over 8 years ago)
- Last Synced: 2025-03-20T01:41:40.118Z (11 months ago)
- Topics: ajax, dom, jquery, minimal
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 21
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mini-jq
迷你版jquery
## 使用
```js
$(document).ready(function () {
var html = $('#container').html();
console.log(html);
var text = $('#container h1').text();
console.log('h1 的文本是 => ' + text);
$('#list li').each(function (index, item) {
console.log($(item).text());
});
console.log('第2个节点的文本是 => ' + $('li').eq(1).text());
console.log('最后一个节点的文本是 => ' + $('li').last().text());
console.log('username => ' + $('#username').val());
$('#changeText').on('click', function () {
console.log('点击按钮后 username => ' + $('#username').val());
});
// $.ajax({
// url: 'https://api.github.com/users/biezhi',
// method: 'get',
// dataType: 'json',
// success: function (response) {
// console.log(response);
// },
// error: function (e) {
// console.error(e);
// }
// });
$.getJSON('https://api.github.com/users/biezhi', function (response) {
console.log(response);
});
});
```
## 参考资料
- https://blog.garstasio.com/you-dont-need-jquery/selectors
- https://github.com/oneuijs/You-Dont-Need-jQuery