특정 데이터를 html 형식으로 가져와서 화면에 갱신해준 뒤 그 후 변경된 데이터에서 특정 데이터를 가져오려고 하다보니...
Jquery change() 메소드가 정상적으로 인식하지 못하는 문제가 있었다.
처음에는 시점에 문제인가 싶어
$('선택자').on(~
형식으로 진행해 봤는데도 정상적으로 적용되지 않아 확인해보니...
The change event is sent to an element when its value changes. This event is limited to <input> elements, <textarea> boxes and <select> elements. For select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse, but for the other element types the event is deferred until the element loses focus.
change는 element의 value값 변경에 대한 이벤트를 감지하는 거고 이건
<input>, <select>, <textarea>
에 한정되서 가능하다고 하네요..
그래서 다른이벤트를 찾아보니
DOMAttrModified
DOMAttributeNameChanged
DOMCharacterDataModified
DOMElementNameChanged
DOMNodeInserted
DOMNodeInsertedIntoDocument
DOMNodeRemoved
DOMNodeRemovedFromDocument
DOMSubtreeModified
이런 이벤트를 적용하면 될 것같아 해보니 성공!
$(document).on('DOMNodeInserted','.선택자', function() {
console.log();
});
위와 같은 형식으로 진행했더니 정상적으로 실행되는 것을 확인했습니다.