Please refer to me a reference or documentation that explain these kind of selection using tag, text and class.
var button_var = $('<button/>',
{
text: 'Click',
class: 'btn_class'
});
Try this reference for the specific jQuery method: http://api.jquery.com/jquery/#jQuery-html-attributes
That is not a selection. That is creating a <button>
DOM element with properties specified by the anonymous object passed as the second parameter.
Note: until the object is added to the DOM somewhere it is a disconnected element.
JSFiddle: http://jsfiddle.net/TrueBlueAussie/zr9tdLv1/
A cut & paste of the resulting DOM element (from Chrome DOM inspector is)
<button class="btn_class">Click</button>
Update: (thanks to mention by @Don P)
As class
is to become a reserved word, you should quote the key name. e.g.
'class': 'btn_class'
It's just creating the element button with html attributes and you'll be able to see the final result like below:
<button class="btn_class">Click</button>
So, by the way you can create the element with the attributes (HTML DOM Properties) all html have like id, data-* attributes. You can also have html
as attribute and use there html like html: '<div>foo</div>'
Thanks to @TrueBlueAussie, found the doc