I am trying to avoid to repeat each time
$('.element1')
,
$('.element1').html()
,
in
myList = [
{
element: $('.element1'),
text: element.html(),
value: 'somevalue'
},
{
element: $('.element2'),
text: element.html(),
value: 'somevalue'
}
];
but actually it is not working, it shows me the eroor:
Uncaught ReferenceError: element is not defined
I need to define and keep everything only inside the "myList",
avoiding to define other external variables etc, and I would like to know how I can use something like this
I really appreciate any help