Im experimenting with Chrome extensions and I found a weird behavior of popup window.
In popup.html is one element <a id="grantexpert">...</a>
and in popup.js I would like to change background color of this element when clicked. The change of color works when changed immediately after document ready. But when in click event, the color is changed for a very short time (just a blink) when clicked and then is immediately returned to original settings. It looks like popup window is reloaded again after click event.
Manifest:
"browser_action": {
"default_popup": "popup/popup.html"
},
popup.html:
<!DOCTYPE html>
<head>
<script src='../other/jquery-3.1.1.min.js'></script>
<script src='popup.js'></script>
</head>
<body style="width:250px;">
<a class="testitem" href id="grantexpert">grantexpert.sk</a>
</body>
</html>
popup.js:
(function($) {
$(document).ready(function() {
//$("#grantexpert").css('font-size', '28px'); - this works
// this does not work
$('#grantexpert').click(function () {
$(this).css('font-size', '28px');
});
});
})(jQuery);
Why does the element change the color for a blink, but does not keep adjusted properties after the click event and reverts them back?