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 ()
,
and additionally has been changed into the script and in the following HTML: mousemove
()
& 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
Post a Comment