## page was renamed from jquery
= jquery =
The purpose of jQuery is to make it much easier to use [[Javascript]] on your website.

http://jquery.com/

== DOM ready ==
{{{#!highlight javascript
$(document).ready(function(){
//......
});
//-----------
$(document).ready(readyx);
function readyx(){
// called on DOM ready
}

}}}

== Find element by id ==
{{{#!highlight javascript
// element id id1234
var x1234 = $("#id1234");
}}}

== Find elements by class ==
{{{#!highlight javascript
// element with class classsdf
var elements = $(".classsdf");
elements.each(  eachHandler  );

function eachHandler(index,element){
console.log(index + ' ' +element);
}
}}}

== Get or set select dropdownlist selected value ==
{{{#!highlight javascript
$("#dropdown").val(); //get value
$("#dropdown").val('asd'); //select value asd
}}}

== .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.
{{{#!highlight javascript
$.get( "test.cgi", { name: "John", time: "2pm" } )
  .done(  function( data ) {
    alert( "Data Loaded: " + data );
  });

$.ajax({
  url: url,
  data: data,
  success: success, // function(data, textStatus,jqXHR )
  error: error , // function( jqXHR, textStatus, errorThrown )
  dataType: dataType // text, html, xml, json, jsonp, and script.
});

}}}


== Select element with . and : in id ==
https://learn.jquery.com/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation/
{{{#!highlight javascript
function jq( myid ) {
    return "#" + myid.replace( /(:|\.|\[|\])/g, "\\$1" );
}
}}}