简体   繁体   中英

Material Design - set input with jQuery

I have edit form, made with material design and I set input with jquery

$("#item").val('value')

But then it has this effect. Until I edit it with a keyboard, js from material design "thinks" there is no text in inputs.

I tried triggering events like .change(), .keyup() or keypress(), it didn't work.

Thanks for any help or tips.

Here is a DEMO

script:

$("#sample1").val('TEST').parent('.mdl-textfield').addClass('is-dirty').removeClass('is-invalid');

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