我想将'keypress'或'change'事件绑定到信息块内的<textarea>
元素(谷歌地图叠加层)。我尝试了以下方法失败:
$("#myTextLabel", postInfoBubbleDiv).on('keypress',function() {
console.log('postTextArea keypressed');
});
我怎样才能让它发挥作用?
注1:此时,当我绑定事件时,信息块打开并“domready”。
注2:我为'click'事件尝试了同样的方法,它工作正常
注3:我需要在jquery调用中将postInfoBubbleDiv
添加到选择器。 postInfoBubbleDiv
是包含<textarea>
的容器div。我真的不明白为什么,但我在某处读到它作为一种解决方法,将事件绑定到信息块内的元素。有人知道为什么吗?
注4:我尝试了Attach event handler to element inside google maps info bubble,但没有成功..再次。
谢谢,
干杯