Selecting Elements by Data Attribute in jQuery

October 13, 2015 by

Selecting elements by data attributes is very easy in jQuery. As with all other attributes, we can simply use the attribute selector. In fact, we do not need to handle the data attribute in any special way, as long as the data attribute is available in the DOM. Please consider the following example. var matches… read more

Selecting Element by Name in jQuery

October 13, 2015 by

Selecting elements based on their name attribute in jQuery is as easy as it should be.¬†We can accomplish this by simply using the attribute selector as follows. For example, to select an input with the name username, use the following selector. var matches = $(‘input[name=”username”]’); Woah, that was easy, wasn’t it?

Getting Query Parameter from URL in JavaScript

September 28, 2015 by

To most people’s surprise, there is not a standard way of accessing query string parameters from JavaScript without first having to parse the query string. Some frameworks and libraries have implemented ways of doing this, but it is not always the case. For example, the ever so popular jQuery has not implemented this, but rather… read more