javascript - jQuery not working if input field is prefilled (toggle clear function) -


I found a jQuery script on that brings a clear sign inside the input field . It fits in my website but it does not work when the input value is prefilled.

I changed the additon for many onchange () , mousemove () and additionally has been changed into the script and in the following HTML:

  & lt; Body onLoad = "tog (v);" & gt;  

JS

  Function tog (v) {return v? 'AddClass': 'removeClass';} $ (document)) .on ('input', '.cluralable', function () {$ (this) [tog (this.value)] ('x');}) . ('Mousemove', '.x', function (e) {$ (this) [tog (this.offsetwidth-18  

But it did not help. Do you have any solutions?

You need to trigger the input event program

$ ('Clear.'). Trigger ('input');


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -