Support » Plugin: YITH WooCommerce Product Add-Ons » how to get Input Text field value

  • Hi, I add one text field to get information from customers.
    now I get the value of this input filed by javascript but it is null.

    Html(from inspect element)(i create one text filed)
    <input type=”text” id=”yith-wapo-9-0″ name=”yith_wapo[][9-0]” value=”” minlength=”1″ maxlength=”111″ data-price=”0″ data-price-sale=”0″ data-price-type=”fixed” data-price-method=”free” data-first-free-enabled=”” data-first-free-options=”” data-addon-id=”9″ required=”” style=”width: 100%;”>

    My javascript
    console.log(document.getElementById(“yith-wapo-9-0”).value);

    Error
    (index):5 Uncaught TypeError: Cannot read properties of null (reading ‘value’)
    at (index):5:53

Viewing 1 replies (of 1 total)
  • Plugin Support Facundo Arano

    (@aranofacundo)

    Hi there,
    Since you are trying to get the value from the frontend using JS, you should check the code you’re using instead.
    The plugin use the default fields from HTML, so you should be able to get the value correctly.
    In my case, I just changed the with ' from your code, and it worked correctly.

    We remain at your disposal.

Viewing 1 replies (of 1 total)
  • The topic ‘how to get Input Text field value’ is closed to new replies.