Page 1 of 1

[Info] JS nuGetValue(), nuSetValue()

Posted: Wed Aug 04, 2021 10:46 am
by admin
The JavaScript functions nuGetValue() and nuSetValue()
make it easy to get and set an object's value without having to know the JavaScript/jQuery syntax that may differ from object to object.

Examples:

1. To get the selected option text of a Select object with jQuery:

Code: Select all

$("#objectId option:selected").text();
and with nuGetValue():

Code: Select all

nuGetValue('objectId','text');
2. To get the Checkbox value in jQuery:

Code: Select all

$('#objectId').is(":checked")
and with nuGetValue():

Code: Select all

nuGetValue('objectId');
2. To set the value of an Input object:

Code: Select all

$('#objectId').val('something').change();
and with nuSetValue():

Code: Select all

nuSetValue('objectId',''something');