Advertisement
brasofilo

wpse_55240_required_alt_text

Jun 21st, 2012
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. add_action('admin_head-media-upload-popup','wpse_55240_required_alt_text');
  2.  
  3. function wpse_55240_required_alt_text()
  4. {
  5.     echo <<<HTML
  6.     <script language="javascript" type="text/javascript">
  7.         jQuery(document).ready(function($) {
  8.             $("#TB_overlay").click(validateAltText);
  9.  
  10.             $("#TB_closeAjaxWindow").click(validateAltText);
  11.  
  12.             function validateAltText() {
  13.                 var value = $(".image_alt input").val();
  14.  
  15.                 if (value)
  16.                     return true;
  17.  
  18.                 alert('Please fill the Alt text');
  19.                 return false;
  20.             }
  21.         });
  22.     </script>
  23. HTML;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement