SHARE
TWEET

Gravity Forms Placeholder

a guest Dec 15th, 2011 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.  
  3. jQuery(function(){
  4. <?php
  5.  
  6. /* Go through each one of the form fields */
  7.  
  8. foreach($form['fields'] as $i=>$field){
  9.  
  10. /* Check if the field has an assigned placeholder */
  11.  
  12. if(isset($field['placeholder']) && !empty($field['placeholder']) && !$is_IE){
  13.  
  14. /* If a placeholder text exists, inject it as a new property to the field using jQuery */
  15.  
  16. ?>
  17.  
  18.  
  19.  
  20. jQuery("#input_<?php echo $form['id']?>_<?php echo $field['id']?>").attr('placeholder',"<?php echo $field['placeholder']?>");
  21.  
  22.  
  23. <?php
  24. }
  25. elseif($is_IE) { ?>
  26.  
  27. jQuery("#input_<?php echo $form['id']?>_<?php echo $field['id']?>").attr('value',"<?php echo $field['placeholder']?>");
  28.  
  29.  
  30. <?php
  31. }
  32. }
  33. ?>
  34. });
  35. </script>
  36. <?php
  37. }
  38. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top