Changed the value value in the console, the document. The getElementById (' usernameId). value=https://bbs.csdn.net/topics/123, click on the page will face failure, how to change the value in the console values make them take effect?
CodePudding user response:
Borrow [NoviScl] post at https://blog.csdn.net/weixin_29470121/article/details/112627197? Utm_medium=distribute. Pc_relevant_bbs_down. None - task - blog - baidujs - 2. Nonecase& Depth_1 - utm_source=distribute. Pc_relevant_bbs_down. None - task - blog - baidujs - 2. The function in the nonecase,The function setNativeValue (element, value) {
Let lastValue=https://bbs.csdn.net/topics/element.value;
Element. The value=https://bbs.csdn.net/topics/value;
Let the event=new event (' input '{
Target: element,
Bubbles: true
});
Event. The simulated=true;
Let the tracker=element. _valueTracker;
If (tracker) {
The tracker. SetValue (lastValue);
}
Element. The dispatchEvent (event);
}
Has been solved, thank you