Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enter an input value with greasemonkey

Tags:

greasemonkey

I have some input values contained within a bunch of divs and a form. I have a limited knowledge of js and would like to use greasemonkey to set the values when the page loads.

The following shows the order of divs and forms to get to the value.

<div data-role="page" id="finalTest">                    
  <div data-role="content">
    <form class="cmxform" id="ftForm">
      <div id="finalTestForOtherDiv" >
        <div data-role="fieldcontain" class="special-spacing">
                <div class="input-div">
                    <label id="finalTestBeforeAcTgrLabel" for="finalTestBeforeAcTg" data-insight="true" 
                        class="mandatory" data-default="mandatory"><img class="label-image" alt="" src="../Images/icon-alert.png" />AC V (T/G):</label>
                    <input type="text" id="finalTestBeforeAcTg" name="finalTestBeforeAcTg" value="" style="width:100px; display:inline-block;" 
                        data-bind="binder.BeforeAcTg"  data-bind-action-when-hidden="Ignore" />
                    <span class="ui-content" style="padding-left:7px;">V</span>
                    <div class="error-message"><ul></ul></div>

                </div>

Here is the script I've tried using but does nothing.

// ==UserScript==
// @name    Final Test
// @description Final test results
// @include https://techaccess.ad.qintra.com/WorkJobs/WorkJobs.aspx#finalTest
// ==/UserScript==

document.getElementById("finalTestBeforeAcTg").value = "0.00";
like image 912
Cameron Darlington Avatar asked Jan 16 '23 14:01

Cameron Darlington


1 Answers

document.getElementById("finalTestBeforeAcTg").value = "your value";
like image 85
Pavel Strakhov Avatar answered Apr 05 '23 03:04

Pavel Strakhov