logo

NJP

Call the Onchange Fucntion in Onload Script

Import · Mar 05, 2018 · article

function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; // Here we write the onload code } //Here we generally write the onChange code

}

Can we write the onChange function within onLoad script, Yes. Please refer below code:

function onLoad() {

gel('ni.IO:' + sys_id_of_variable).onchange = function() {

/*------------------------- // Here we can write the Onchange code--------------------------------------------------*/}

}

It will reduce the re-write the multiple on-change scripts.

Thanks,

Faiji

Labels:

image

View original source

https://www.servicenow.com/community/developer-articles/call-the-onchange-fucntion-in-onload-script/ta-p/2329732