optimized js for inline editing