From 47f040f7402c13a7a2e13497ef703c45671e72eb Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 1 Nov 2010 16:45:09 -0700 Subject: [PATCH] Use jquery id selector --- app/views/photos/_new_photo.haml | 2 +- public/javascripts/photo.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/photos/_new_photo.haml b/app/views/photos/_new_photo.haml index dd029008e..a6f1f5908 100644 --- a/app/views/photos/_new_photo.haml +++ b/app/views/photos/_new_photo.haml @@ -5,7 +5,7 @@ :javascript function createUploader(){ var uploader = new qq.FileUploader({ - element: document.getElementById('file-upload'), + element: $('#file-upload'), params: {'photo' : { 'album_id' : "#{album_id}", 'to' : "#{aspect_id}"}, 'set_profile_image' : "#{set_profile_image if defined?(set_profile_image)}"}, allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'], action: "#{photos_path}" diff --git a/public/javascripts/photo.js b/public/javascripts/photo.js index b0f8e0729..ff20a1735 100644 --- a/public/javascripts/photo.js +++ b/public/javascripts/photo.js @@ -8,12 +8,12 @@ $(document).keydown(function(e){ switch(e.keyCode) { case 37: if(!$("textarea").hasClass("hasfocus")){//prevent redirect if textarea has focus - window.location = document.getElementById("prev_photo").href; + window.location = $("#prev_photo").attr('href'); } break; case 39: if(!$("textarea").hasClass("hasfocus")){ - window.location = document.getElementById("next_photo").href; + window.location = $("#next_photo").attr('href'); } break; } @@ -41,7 +41,7 @@ $(document).ready(function(){ var method = $edit_photo.attr("method"); var url = $edit_photo.attr("action"); var data = $edit_photo.serialize(); - $(".description").text(document.getElementById("photo_caption").value); + $(".description").text($("#photo_caption").val()); $edit_photo.toggle(); $.ajax({