With jQuery, I'm interested in making the following interaction model.
-
When a user types in a page, then notice the jQuery three !, "!!!" Typed in a row to be able to do something about it
-
After watching the three, "!!!" wrap the previous sentence, the user currently has a
How can I do this?
This should work. I've set it as a live event handler (so it can be dynamically added to the page for elements), but you can use any textarea or input element On the normal keyboard handler, you can use the exact same function.
Checks to check whether the current value of the element is !!! Ends with and if it does so, then substitutes, both use regular regular expressions.
$ ("input, texter") live (live "funnel", function () {var $ this = $ (this); var value = $ this.val (); if ( / !!! $ / test (value)) {$ this.val (value.replace (/(\.?)([^.]+$.ss*)!!!$/, '$ 1 & Lt; span cl donkey = "important"> $ 2 ;));}});
Comments
Post a Comment