javascript - How to test if an input contains a question mark? -


I have a script which tests, if there is an input question mark, and if this happens then some CSS changes is. How can I do this?

jQuery usage : <("" " "=") = $ 1) {$ ("# someotherelement") CSS ("color", "red"); $ (This). CSS ("color", "green"); } And {warnings ("question mark is not included"); }

Do not use jQuery:

  if (document.getElementById ('myinputbox'). Value.indexOf ("?") = 1) { Document.getElementById ("Some LayerHelments") ClassName + = "NewClass"; This.className + = "NewClass"; } And {warnings ("question mark is not included"); }   

Update: Confirm KidDown ()

  $ ("# myinputbox"). Keydown (function () (if ($ (This) .val () IndexOf ("?") = -1) {$ (this). CSS ("color", "green");} and {$ (this ) .css ("color", "red");}});    

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -