Skip to main content

Posts

Showing posts from January, 2014

Pseduo-RegEx JQuery Selectors

More often than not I find myself using only few jQuery selectors to locate elements in DOM for event binding; however, jQuery also offers some powerful psedo-RegEx selectors for locating elements. Say, you have the following HTML5 markup: -------------------------------------------------- <!DOCTYPE HTML> < html lang = "en" > < head > < meta charset = "UTF-8" > < title > JQuery Selector </ title > </ head > < body > < article class = "post-article" > < header class = "article-header" > </ header > < p class = "article-content" > </ p > </ article > </ body > </ html > -------------------------------------------------- You can use the following selectors to locate the "article-header" element. 1- Using closest     $(".post-article").closest("header").fi