Miko. eCommerce Template

Mon. - Fri. 9 am - 5 pm Ask a Question
Remember me

Input Fields

5 months 4 weeks ago #1

  • ian's Avatar
  • ian
  • Posts: 3
Hello

Is it possible for JavaScript to set the values of the text inputs, ie ...

document.getElementById("myText").value = "sometext";

Thanks

5 months 4 weeks ago #2

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 16531
Hello,

Thank you for contacting us!

Yes it is possible :)

Best Regards,
Vyacheslav, Balbooa Support Team

5 months 4 weeks ago #3

  • ian's Avatar
  • ian
  • Posts: 3
Can you indicate how its done, been trying with no success .

5 months 4 weeks ago #4

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 16531
You need to add the class custom-class for the field
and add the code in the code editor
document.addEventListener('DOMContentLoaded', function(){
    document.querySelectorAll('.custom-class').forEach(function(input){
        input.value = 'My Simple Value';
    })
});


Best Regards,
Vyacheslav, Balbooa Support Team

5 months 4 weeks ago #5

  • ian's Avatar
  • ian
  • Posts: 3
Thanks

5 months 4 weeks ago #6

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 16531
You are welcome ;)
Powered by Kunena Forum