jquery
The purpose of jQuery is to make it much easier to use Javascript on your website.
DOM ready
Find element by id
Find elements by class
Get or set select dropdownlist selected value
.attr( attributeName )
Returns String Get the value of an attribute for the first element in the set of matched elements.
.text()
Returns String Get the combined text contents of each element in the set of matched elements, including their descendants.
html()
Returns String Get the HTML contents of the first element in the set of matched elements.
.append( content [, content ] )
Returns jQuery Insert content, specified by the parameter, to the end of each element in the set of matched elements.
.empty()
Returns jQuery Remove all child nodes of the set of matched elements from the DOM.
jQuery.get( url [, data ] [, success ] [, dataType ] )
Returns jqXHR Load data from the server using a HTTP GET request.
1 $.get( "test.cgi", { name: "John", time: "2pm" } )
2 .done( function( data ) {
3 alert( "Data Loaded: " + data );
4 });
5
6 $.ajax({
7 url: url,
8 data: data,
9 success: success, // function(data, textStatus,jqXHR )
10 error: error , // function( jqXHR, textStatus, errorThrown )
11 dataType: dataType // text, html, xml, json, jsonp, and script.
12 });
Select element with . and : in id
Ajax error handler
function onError(xhr, status, error){ console.log(xhr.responseText); // text returned on error }