Javascript:如何更改输入?

时间:2016-05-13 09:09:46

标签: javascript google-chrome

我想使用Chrome控制台更新输入内容。

班级:

<input type="text" class="answerInput __web-inspector-hide-shortcut__" maxlength="20" autocomplete="off">

1 个答案:

答案 0 :(得分:0)

所以你想在控制台中键入这样的东西

对于ID:

$('#ID-OF-INPUT-GOES-HERE').val('I will appear in input')

对于班级:

$('.CLASS-OF-INPUT-GOES-HERE').val('I will appear in input')

document.getElementsByClassName('CLASS-OF-INPUT-GOES-HERE')[0].value = 'i will appear in input'