When I do console.log($(this));
I got the following information:-
I want to join the $(this)
, go into context
, and then into attributes
. How?
When I do console.log($(this));
I got the following information:-
I want to join the $(this)
, go into context
, and then into attributes
. How?
Suppose you want to get the attribute from this element-
<div class="test_class" data-somevalue="this is value"> </div>
You can use-
$(".test_class").attr("data-somevalue")
//or
$(".test_class").data("somevalue")
In your case, you can also use
const finalVal = Object.assign({}, $(this), $(this).context, $(this). attributes)