jQuery- Detect change in the content of a SPAN field

后端 未结 2 2130
没有蜡笔的小新
没有蜡笔的小新 2021-02-07 18:48

I have the below piece of code which is used to simulate a text box:




        
2条回答
  •  梦毁少年i
    2021-02-07 19:21

    i think this code will help you.

    $(document).ready( function() {
        $('#myId').bind( "contentchange", function(){
            alert("Changed");
        });
    
        $( "#btn" ).click( function () {
            $('#myId').html( "Value" ).trigger( "contentchange" );
        });
    });
    

    http://jsfiddle.net/RKLmA/192/

提交回复
热议问题