I have a bit of code where I am looping through all the select boxes on a page and binding a .hover
event to them to do a bit of twiddling with their width on mouse on/off
. 我有一些代碼,我在其中循環瀏覽頁面上的全部選擇框,並將.hover
事件綁定到它們,以便在mouse on/off
對其寬度進行一些調整。 app
This happens on page ready and works just fine. 這在頁面準備就緒時發生,而且工做正常。 oop
The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound. 個人問題是,在初始循環以後,我經過Ajax或DOM添加的全部選擇框都沒有事件綁定。 this
I have found this plugin ( jQuery Live Query Plugin ), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option. 我已經找到了這個插件( jQuery Live Query Plugin ),可是在我使用插件向頁面添加另外一個5k以前,我想看看是否有人知道直接使用jQuery或經過其餘方法作到這一點的方法。 spa