Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

[Info] JS nuGetValue(), nuSetValue()

Information about updates, news, Code Library
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

[Info] JS nuGetValue(), nuSetValue()

Unread post 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');
Post Reply