jamehan9516

jQuery监听div标签的内容变化,并获取文本值

下拉框形式的DIV标签,如何获取当前选中的文本值?

jQuery写法示例:

  var title = $("b.facility");
  var title = $(\'#title\'); //the element I want to monitor
  title.bind(\'DOMNodeInserted\', function(e) {
  alert(\'element now contains: \' + $(e.target).html());
  });

tips:jQuery事件中的change()方法定义和用法:当元素的值发生改变时,会发生 change 事件。该事件仅适用于文本域(text field),以及 textarea 和 select 元素,当用于 select 元素时,change 事件会在选择某个选项时发生。当用于 text field 或 text area 时,该事件会在元素失去焦点时发生。

 

分类:

技术点:

相关文章:

  • 2021-10-17
  • 2021-11-30
  • 2022-12-23
  • 2021-11-30
  • 2021-05-31
  • 2022-02-16
  • 2022-12-23
  • 2021-12-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-03
相关资源
相似解决方案