.value not working to change textbox

14 views
Skip to first unread message

Joel Anderson

unread,
Oct 15, 2016, 2:47:57 PM10/15/16
to greasemonkey-users
Hi,

I'm trying to update some text fields in some online accounting software.  I can change the textbox using jquery and .value however when I click the save button it is like I never changed the field.  I'm wondering if there is something else I should be doing or some other attribute other than .value I should be using instead.


var employer = 10.0;
$('#payslip > div:nth-child(2) > div > div:nth-child(5) > div.xb-igrid-body > div.xb-igrid-data > div > div.xb-igrid-col.xb-igrid-col5 > input')[0].value = employer.toFixed(2);


Note the source textbox I am targetting looks like this:

<input type="text" class="form-control" data-bind="value: formula.amount,
                                                              attr: {'disabled': !formula.amountEditable},
                                                              xbmask: 'currency',
                                                              css: { 'has-error': hasError }">

Cheers

Brian L. Matthews

unread,
Oct 15, 2016, 3:14:32 PM10/15/16
to greasemon...@googlegroups.com
For checkboxes, the value property is the value sent to the server, if
the checkbox is checked, it doesn't determine whether the checkbox is
checked or not. Use the checked property for that, so
<checkboxelem>.checked = true checks it, <checkboxelem>.checked = false
unchecks it.

Brian
Reply all
Reply to author
Forward
0 new messages