使用JQuery动态更改MDL文本字段文本

使用JQuery动态更改MDL文本字段文本,jquery,dynamic,material-design-lite,Jquery,Dynamic,Material Design Lite,我正在尝试使用JQuery更改MDL文本字段文本。但是,出现了一些问题,首先标签没有设置动画,对于基本文本字段,占位符文本没有消失。其次,如果一个文本字段被标记为required,那么在通过JQuery设置它的值之后,该字段将保持红色,就像没有在其中放置任何内容一样 HTML: 我想这就是你要找的 $('#numero-ficha')[0].parentElement.MaterialTextfield.change("15"); $('#nome-ficha')[0].parentElemen

我正在尝试使用JQuery更改MDL文本字段文本。但是,出现了一些问题,首先标签没有设置动画,对于基本文本字段,占位符文本没有消失。其次,如果一个文本字段被标记为
required
,那么在通过JQuery设置它的值之后,该字段将保持红色,就像没有在其中放置任何内容一样

HTML:


我想这就是你要找的

$('#numero-ficha')[0].parentElement.MaterialTextfield.change("15");
$('#nome-ficha')[0].parentElement.MaterialTextfield.change("some text");

没错!非常感谢你。
//Do something
$("#numero-ficha").val(value.number);
$("#nome-ficha").val(value.username);
//Do something
$('#numero-ficha')[0].parentElement.MaterialTextfield.change("15");
$('#nome-ficha')[0].parentElement.MaterialTextfield.change("some text");