Onblur function
-
Hello and thank you so much for the plugin.
I need some help with adding function onblur.
I have shortcode in my CF7
[dynamictext your-city id:your-city “geoip_detect2 property=’city'”]
that displays city of a user.The city name must be Capitalized so I use a fanction
<script type=”text/javascript”> function upperCaseFirstLetters(ABC123) { var myTextObject = document.getElementById(ABC123); myTextObject.value = myTextObject.value.replace(/\W\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); } </script>
Last, it should be added in <input> tag
<input type=”text” name=”your-city” value=”Moscow” size=”40″ class=”wpcf7-form-control wpcf7dtx-dynamictext wpcf7-dynamictext” id=”your-city” aria-invalid=”false” onblur=”upperCaseFirstLetters(this.id)”>
Help me to add this line onblur=”upperCaseFirstLetters(this.id)” for the input.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Onblur function’ is closed to new replies.