How to Auto Fill Input Field With Static Value in Form Through JS in WordPress

Опубликовано: 10 Август 2022
на канале: WebTask With Hassan
1,219
7

In this wordpress tutorial for beginners you will learn how to fill input field with static value automatically in wordpress form through JavaScript code. So user can not edit input field from frontend form. First Install plugin Simple Custom CSS and JS and then add new js file and then paste code. Also you need to identify input field id so we will use ID in jquery code.

So Add this code in js file.

jQuery(document).ready(function( $ ){
$("#flw-amount").val("1000");
$("#flw-amount").prop('disabled', true);
});

* Add your input field ID instead of ID #flw-amount in code.

and if you are using another js plugin so check script tag also on opening and ending.

#input #field #javascript #js #script #form #wordpress #autofill #webtaskwithhassan #hassangilani