Commit bb5ef546c8d117bf3187d20c9d903d4336d5ba48

Authored by Antonio Terceiro
1 parent c1862e35

Avoide recurring calls to $()

Showing 1 changed file with 4 additions and 3 deletions   Show diff stats
public/javascripts/article.js
@@ -106,13 +106,14 @@ jQuery(function($) { @@ -106,13 +106,14 @@ jQuery(function($) {
106 106
107 } else { 107 } else {
108 // simple text editor 108 // simple text editor
109 - var text = $('#' + text_field).val(); 109 + var $text_element = $('#' + text_field);
  110 + var text = $text_element.val();
110 var $item = $wrapper.children().first(); 111 var $item = $wrapper.children().first();
111 if ($item.attr('src')) { 112 if ($item.attr('src')) {
112 - $('#article_body').val(text + '!' + $item.attr('src') + '!'); 113 + $text_element.val(text + '!' + $item.attr('src') + '!');
113 } 114 }
114 if ($item.attr('href')) { 115 if ($item.attr('href')) {
115 - $('#article_body').val(text + $item.attr('href')); 116 + $text_element.val(text + $item.attr('href'));
116 } 117 }
117 } 118 }
118 } 119 }