Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- }
- /* We use jQuery to read the placeholder value and inject it to its field */
- add_action('gform_enqueue_scripts',"my_gform_enqueue_scripts", 10, 2);
- function my_gform_enqueue_scripts($form, $is_ajax=false){
- global $is_IE;
- ?>
- <script>
- jQuery(function(){
- <?php
- /* Go through each one of the form fields */
- foreach($form['fields'] as $i=>$field){
- /* Check if the field has an assigned placeholder */
- if(isset($field['placeholder']) && !empty($field['placeholder']) && !$is_IE){
- /* If a placeholder text exists, inject it as a new property to the field using jQuery */
- ?>
- jQuery("#input_<?php echo $form['id']?>_<?php echo $field['id']?>").attr('placeholder',"<?php echo $field['placeholder']?>");
- <?php
- }
- elseif($is_IE) { ?>
- jQuery("#input_<?php echo $form['id']?>_<?php echo $field['id']?>").attr('value',"<?php echo $field['placeholder']?>");
- <?php
- }
- }
- ?>
- });
- </script>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement