$(document).ready() for certain situations?
I have a site where I need to send outbound clicks to open in a new window (yes, I generally understand this is not the recommended behavior.) The way I have it set up now is using $(document).ready() because if I put it in pageinit it binds multiple times as you're navigating pages in the site.
- $(document).ready(function(){
- $('.block').on('tap', 'a[data-outbound=true]', function(event){
- window.open(this.href,'_blank');
- return false;
- })
Is there any reason this is a bad idea that I'm missing. It seems to work fine.