Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

wpse_55240_required_alt_text

By: brasofilo on Jun 21st, 2012  |  syntax: PHP  |  size: 0.55 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }