I have div in my html. On a button click event, I want to get all style attribute at once, so that I can use it for another task
<div id=popUp style="display: block; z-index: 1050; top: 371px; left: 847.75px;">
</div>
<button id="btn" value="submit">
$('#btn').on('click', function (event){
var styleAttribute=$('#popUp').css('style');
console.log('styleAttribute',styleAttribute);
});
It gives undefined. What I want is this as console.
display: block; z-index: 1050; top: 371px; left: 847.75px;