Category Archives: jquery

Using javascript to avoid the mouse and page scrolling

Here’s the problem. It is not very easy to scroll a document when you’re inside an input element. Arrow keys don’t work, and Page Up/Page Down jump in big increments. What if you want to see just a few lines below the current element? Our clients hate to scroll. And they hate having to use [...]
Also posted in code, js, programming | Leave a comment

`calculable’ textboxes using jquery

Here’s some code to make your textboxes calculable. Demonstration here. (function($) { $.fn.calculable = function() { return this.each(function() { $(this).focus(function(e) { var expr = $(this).attr('calcExpr'); if (expr) { $(this).val(expr); } }); // end focus $(this).blur(function(e) { try { var expr = $(this).val(); var calculated = eval('with(Math){'+expr+'}'); $(this).attr('calcExpr', expr); $(this).val(calculated); } catch (e) { $(this).attr('calcExpr', ''); [...]
Also posted in code, js | 1 Comment
  • Previously …

  • Categories

  • Meta