It seems that I cannot call focus () in the text box of my chrome popup when it opens / after ondomready.
I have something like this in popup.js:
$(document).ready(function () { console.log($("#moped-text")); $('textarea').focus(); $('.container').css("color", "red"); });
I refer to it in popup.html as follows:
<html> <head> <link rel="stylesheet" href="css/content.css" type="text/css"> <script type="text/javascript" src="js/lib/jquery.js"></script> <script type="text/javascript" src="js/popup.js"></script> </head> <body> <div class="container"> <textarea name="newText"></textarea> </div> </body>
Work css-shift, focus () does not work!
When I debug the popup and type $ ('textarea'). focus (); it works in the console. Also, events added inside the ready callback are successfully connected.
Any help is much appreciated!
source share