简体   繁体   中英

jQuery textchange plugin doesn't work

I have tried to add "jQuery textchange plugin" to my code. Here it is: http://www.zurb.com/playground/jquery-text-change-custom-event

Here are the parts of my code, I think it will be enough:

page.html:

//...other code
<script type="text/javascript" src="resources/javascripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="resources/javascripts/jquery.textchange.js"></script>
<script type="text/javascript" src="resources/javascripts/formscript.js"></script>
//...other code 

//...
<input type="text" placeholder='placeholder' class='necess'>
//...other code

fornscritp.js:

//...other code

$(document).ready(function() {
    $(".necess").bind("hastext", function () {
        alert('YES');
    });
});

So I want to see the message 'YES' when I'm start typing something into my INPUT, but unfortunately it didn't work.

I try this with "textchange" and try to change tag from INPUT to TEXTAREA like on the examples on the site, but it also didn't help.

I spent hours and tryed to GOOGLE IT but didn't find the answer. Even thought that I uset this plugin wrong.

Tell me please what am I doing wrong!

So, I think I've found the answer. It's everything right on the code above. But I also had some 'script' line where I've added another jQuery library. When I deleted this line everything started work. I found this mistake by analyzing the code and resources of this page:

http://www.zurb.com/playground/jquery-text-change-custom-event

(just download everything, and comment each line while found something which may cause the bug, but didn't found) So, now everything works. The only advice I can give to someone with the mistakes like this is to be more attentive to your code:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM