From bb5ef546c8d117bf3187d20c9d903d4336d5ba48 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 12 Jul 2012 11:13:18 -0300 Subject: [PATCH] Avoide recurring calls to $() --- public/javascripts/article.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/javascripts/article.js b/public/javascripts/article.js index e91ae9b..f016a3e 100644 --- a/public/javascripts/article.js +++ b/public/javascripts/article.js @@ -106,13 +106,14 @@ jQuery(function($) { } else { // simple text editor - var text = $('#' + text_field).val(); + var $text_element = $('#' + text_field); + var text = $text_element.val(); var $item = $wrapper.children().first(); if ($item.attr('src')) { - $('#article_body').val(text + '!' + $item.attr('src') + '!'); + $text_element.val(text + '!' + $item.attr('src') + '!'); } if ($item.attr('href')) { - $('#article_body').val(text + $item.attr('href')); + $text_element.val(text + $item.attr('href')); } } } -- libgit2 0.21.2