public static function set_default_field($field) { if (get_display_mode() == 'mobile') { return false; } if (self::$_default_field) { return false; } self::$_default_field = $field; ?> <script type="text/javascript"> $(function(){ if($('#<?php echo $field; ?> ').length>0){ $('#<?php echo $field; ?> ')[0].focus(); } }); </script> <?php return true; }