Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Javascripts improved

  • Loading branch information...
commit e7c6503fd6c68a791055082c02d7f28d06bca051 1 parent bb9b987
@matthiassiegel authored
Showing with 9 additions and 7 deletions.
  1. +9 −7 scripts.js
View
16 scripts.js
@@ -1,19 +1,21 @@
jQuery(document).ready(function($) {
$('#related-posts-select').change(function() {
- var container = $('#related-posts');
- var id = $(this).val();
- var title = this.options[this.options.selectedIndex].text;
+ var select = $(this),
+ container = $('#related-posts'),
+ id = select.val(),
+ title = this.options[this.options.selectedIndex].text;
if ($('#related-post-' + id).length == 0) {
- container.prepend('<div class="related-post" id="related-post-' + id + '"><input type="hidden" name="related-posts[]" value="' + id + '" /><span class="related-post-title">' + title + '</span><a href="#">Delete</a></div>');
+ container.prepend('<div class="related-post" id="related-post-' + id + '"><input type="hidden" name="related-posts[]" value="' + id + '"><span class="related-post-title">' + title + '</span><a href="#">Delete</a></div>');
}
});
$('.related-post a').live('click', function() {
- $(this).parent().css('background-color', '#ff0000');
- $(this).parent().fadeOut('normal', function() {
- $(this).remove();
+ var div = $(this).parent();
+
+ div.css('background-color', '#ff0000').fadeOut('normal', function() {
+ div.remove();
});
return false;
});
Please sign in to comment.
Something went wrong with that request. Please try again.