I wanted to prepare a table row as a template in a HTML doc in order for not typing it in JS as what I've done mostly. I just saved the DOM element as JQuery object and cloned but doing it in a element seems it doesn't saved as an object.
I'm avoiding declaring in JS:
var _row = '<tr><td></td></tr>';
Since I wanted to make the element as dynamic by JS rather than declaring it as a string so I'm trying to create a HTML template for a table row.
In HTML:
<tr id='sampleRow'></tr>
In JS:
var _row = $('#sampleRow');
When consoling log the _row will give a result of init rather than an object.
How can I possibly accomplish like this?
In HTML:
<div class='sampleDiv'></div>
In JS:
var _container = $('.sampleDiv').clone();
In which it is an object.
initobject because there may not be anyDOMelement associated with that selector.