Ecommerce Shopify WordPress Discussion

Change html fields placeholder on select in WP

I want to change my field placeholder when other way of sending is chosen, email or phone. My section looks like this rn, https://cq32719-wordpress-t11rb.tw1.ru/. enter image description here I got this from chatgpt, and it works on just html file, but won't on Wordpress: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Contact Form</title> <style> label { display: block; margin-bottom: 10px; } </style> </head> <body> <form id="myForm"> <label for="name">Name:</label> <input type="text" id="name" name="name" required> <label for="contactSelector">Contact Method:</label> <select id="contactSelector" name="contactMethod" onchange="updatePlaceholder()"> <option value="phone">Phone</option> <option value="email">Email</option> </select> <label for="contactInfo">Field 2:</label> <input type="text" id="contactInfo" name="contactInfo" placeholder="+7 999 999-99-99" required> <button type="submit">Submit</button> </form> <script> function updatePlaceholder() { const selector = document.getElementById("contactSelector"); const field2 = document.getElementById("contactInfo"); if (selector.value === "email") { field2.placeholder = "example@gmail.com"; } else if (selector.value === "phone") { field2.placeholder = "+7 (000) 000-00-00"; } } </script> </body> </html> It's probably bcs I don't have onchange in my select field, but I can't add this to wp's field
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.