Please allow me to ask a silly question about javascript function. I wonder if there's a way to call javascript function from the div. Without giving an id nor class.
Function
function callTest(){
name=$(this).attr('data-name');
clr=$(this).attr('data-clr');
$(this).html(name+'/'+clr);
}
Then I want to print the data from the parent div into its content. By doing something like this.
<div data-name="john" data-clr="red">
<script>callTest()</script>
</div>
So I expect this div
will filled with john/red
. The reason is there will be a lot of div which is need to pass variable on it's own.