this.$ = this.jQuery = jQuery.noConflict(true); $(function () { var textarea = $("#message"); $(document.body).keydown(function (e) { if (e.which == 38 && textarea.val() == "") { $("[id^=edit_post]:last a")[0].onclick(); } }); });