skip to Main Content

First of all, I must say that I am less than noob in this field.
I’ve been sitting on a problem all morning.

What I want to do:
I often need to change prices (200+ rows) in a table on the web interface. To improve this, I already have an Excel VBA file to calculate the correct values, now I want to remove the manual input of the 200+ rows in the browser.
I only need to change it "visually" as I can save the values after.

I thought this could hopefully be done with the inspection console in Chrome.
Manually it works if I change the value in the code (red bordered value="3.33" to whatever I want).
Now I’m trying to find the right code to change it in the console without clicking in the code.
I tried it already with

document.getElementById(‘LAYOUT_DONNEES_PRIX-2-16-cell’).value=’1,00′;

or

document.getElementByName(‘LAYOUT_DONNEES_PRIX-2-16′).value=’1,00’;

but without success. (left Screenshots).
You can see document.getElementsById returns "null", document.getElementsByName returns the NodeList.

As I already told you I am a total noob on this, so hopefully you can easily tell me what parameter I need to choose.

Please let me know if you need any additional information of the code or anything else.

Screenshot:
enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    I have found the answer:

    document.getElementsByName('LAYOUT_DONNEES_PRIX-2-16')[0].value='1,2' document.getElementsByName('LAYOUT_DONNEES_PRIX-3-16')[0].value='2,11'

    works great to change the values

    Thank you all


  2. Try this code:

    var newValue = '5.00'; // Replace '3.33' with the desired new value
    
    var elements = document.querySelectorAll('input[value="3.33"]');
    
    for (var i = 0; i < elements.length; i++) {
        elements[i].value = newValue;
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search