MCPcopy Index your code
hub / github.com/bugy/script-server / setInputValue

Function setInputValue

web-src/src/common/utils/common.js:401–422  ·  view source on GitHub ↗
(inputField, value, triggerEvent)

Source from the content-addressed store, hash-verified

399}
400
401export function setInputValue(inputField, value, triggerEvent) {
402 if (isNull(triggerEvent)) {
403 triggerEvent = false;
404 }
405
406 if (inputField.type === 'checkbox') {
407 inputField.checked = value;
408 inputField.indeterminate = isNull(value)
409 } else {
410 inputField.value = value;
411 }
412
413 if (triggerEvent) {
414 const event = document.createEvent('HTMLEvents');
415 let eventType = 'input';
416 if (inputField.tagName === 'SELECT') {
417 eventType = 'change';
418 }
419 event.initEvent(eventType, true, true);
420 inputField.dispatchEvent(event);
421 }
422}
423
424if (!String.prototype.endsWith) {
425 String.prototype.endsWith = function (search, this_len) {

Callers 5

textfield_test.jsFile · 0.90
TextArea_test.jsFile · 0.90
setValueByUserFunction · 0.90
setUiMappingScriptValueFunction · 0.90
setUiMappingUiValueFunction · 0.90

Calls 1

isNullFunction · 0.85

Tested by

no test coverage detected