Listen to changes within a DIV and act accordingly

后端 未结 7 595
谎友^
谎友^ 2020-11-28 23:34

I have a function that grabs an XML document and transforms it according to an XSL document. It then places the result into a div with the id laneconfigdisplay

7条回答
  •  渐次进展
    2020-11-29 00:34

    If possible you can change the div to an textarea and use .change().

    Another solution could be use a hidden textarea and update the textarea same time as you update the div. Then use .change() on the hidden textarea.

    You can also use http://www.jacklmoore.com/autosize/ to make the text area act more like a div.

    
    
    
    
    
    $("#hiddentextarea").change(function() {
    
    alert('Textarea changed');
    
    })
    

    Update: It seems like textarea has to be defocused after updated, for more info: How do I set up a listener in jQuery/javascript to monitor a if a value in the textbox has changed?

提交回复
热议问题