Is there a cross-browser solution for monitoring when the document.activeElement changes?

While @James’s answer above is correct. I’ve added more details to make it a completely working solution along with the use of focus event too. <html> <body> <input type=”text” id=”Text1″ name =”Text1″ value=””/> <input type=”text” id=”Text2″ name =”Text2″ value=””/> <SELECT><OPTION>ASDASD</OPTION><OPTION>A232</OPTION></SELECT> <INPUT TYPE=”CHECKBOX” id=”Check1″/> <INPUT type=”TEXT” id=”text3″/> <input type=”radio”/> <div id=”console”> </div> <textarea id=”textarea1″> </textarea> <script> … Read more

add excel file attachment when sending python email

This is the code that worked for me- to send an email with an attachment in python #!/usr/bin/python import smtplib,ssl from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from email.mime.text import MIMEText from email.utils import formatdate from email import encoders def send_mail(send_from,send_to,subject,text,files,server,port,username=””,password=”,isTls=True): msg = MIMEMultipart() msg[‘From’] = send_from msg[‘To’] = send_to msg[‘Date’] = formatdate(localtime = … Read more

In MongoDB, if collection is dropped, indexes dropped automatically as well?

Short answer: yes. Indexes are dropping on collection drop. You need to recreate an index. You may want to not to drop collection but remove all items in it with db.collection_name.remove({}). It will take more resources but leave your indexes. Actually it will need to delete all index data. That is why it is more … Read more

jQuery – function inside $(document).ready function

Yes, you can do that, it’s just a matter of scope. If you only need to access callMe() from within $(document).ready(function() { }), then it’s fine to put the function there, and offers some architecture benefits because you can’t access the function outside of that context. If you need to use the callMe() function outside … Read more