Programmatically change placeholder of select field
-
I’ve searched this forum and all over the internet about this problem, and as I couldn’t find any solution, I’d like to ask for help here.
The case: Based on the inputs of the user, I need to dynamically adjust some select fields further down, i.e. create new options and also change the placeholder.
The problem: Adding options works with jQuery’s append method. I couldn’t find a way to change the placeholder.
Solutions i tried without success:
– change placeholder/data-placeholder with HTML setAttribute -> no effect
– change placeholder/data-placeholder with jQuery attr -> no effect
– change placeholder/data-placeholder with .select2({“data-placeholder”: “new placeholder”}) -> no effect
– add option without value instead of placeholder in Forminator Edit Form -> shows standard “Please select an option” instead my entered label for the 1st option
– no placeholder and no selected option -> not allowed for required fields by Forminator, and I need the field to be required
- The topic ‘Programmatically change placeholder of select field’ is closed to new replies.