.children() and .parent() in jQuery

.children( [selector] )

selectorA string containing a selector expression to match elements against.

Given a jQuery object that represents a set of DOM elements, the .children() method allows us to search through the immediate children of these elements in the DOM tree and construct a new jQuery object from the matching elements. The .find() and .children() methods are similar, except that the latter only travels a single level down the DOM tree. Note also that like most jQuery methods, .children() does not return text nodes; to get all children including text and comment nodes, use .contents().

The method optionally accepts a selector expression of the same type that we can pass to the $() function. If the selector is supplied, the elements will be filtered by testing whether they match it.

jQuery(‘parent > child’)
    parent
    Any valid selector.
    child
    A selector to filter the child elements.

As a CSS selector, the child combinator is supported by all modern web browsers including Safari, Firefox, Opera, Chrome, and Internet Explorer 7 and above, but notably not by Internet Explorer versions 6 and below. However, in jQuery, this selector (along with all others) works across all supported browsers, including IE6.

The child combinator (E > F) can be thought of as a more specific form of the descendant combinator (E F) in that it selects only first-level descendants.

Get URL parameter in javascript

1:  function getParameterFromUrl(ParameterName) {
2:      return decodeURI((RegExp(ParameterName + '=' + '(.+?)(&|$)').exec(location.search) || [, null])[1]);
3:  }
4:   

call this function, e.g.

url is http://www.jack-fx.com/default.aspx?id=1

var para = getParameterFromUrl(id); // para will be 1

var p1= getParameterFromUrl(notExistPara); // p1 will be null