×

注意!页面内容来自https://jquery.com/,本站不储存任何内容,为了更好的阅读体验进行在线解析,若有广告出现,请及时反馈。若您觉得侵犯了您的利益,请通知我们进行删除,然后访问 原网页

What is jQuery?

jQuery is a fastsmalland feature-rich JavaScript library. It makes things like HTML document traversal and manipulationevent handling, animationand Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibilityjQuery has changed the way that millions of people write JavaScript.

A Brief Look

DOM Traversal and Manipulation

Get the <button> element with the class 'continue' and change its HTML to 'Next Step...'

1
$( "button.continue" ).html( "Next Step..." )

Event Handling

Show the #banner-message element that is hidden with display:none in its CSS when any button in #button-container is clicked.

1
2
3
4
var hiddenBox = $( "#banner-message" );
$( "#button-container button" ).on( "click"function( event ) {
hiddenBox.show();
});

Ajax

Call a local script on the server /api/getWeather with the query parameter zipcode=97201 and replace the element #weather-temp's html with the returned text.

1
2
3
4
5
6
7
8
9
$.ajax({
url: "/api/getWeather",
data: {
zipcode: 97201
},
success: function( result ) {
$( "#weather-temp" ).html( "<strong>" + result + "</strong> degrees" );
}
});

Related Projects

jQuery UI

This project is in maintenance-only mode. Learn more.

jQuery Mobile

This project is deprecated. Learn more.