Created
February 25, 2011 15:13
-
-
Save thinkt4nk/843920 to your computer and use it in GitHub Desktop.
mto inputs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
// initial input addition | |
$(".forum_thumbnail_addThumbnail").live('click',function() { | |
var $this = $(this); | |
$.get('/forum/ajaxGetThumbnailInput',function(data,status) { | |
if( status == 'success' ) { | |
$(data).appendTo($this.parent().parent()); | |
$this.parent().hide(); | |
} | |
}); | |
}); | |
$(".destroy").live('click',function() { | |
if( $(this).parent().siblings().length < 2 ) { // one sibling is the initial anchor | |
$(".forum_thumbnail_addThumbnail").parent().show(); | |
} else { | |
var thisAddAnchor = $(this).parent().find('.forum_thumbnail_getInput'); | |
var addAnchor = $(thisAddAnchor).clone(); | |
$(addAnchor).appendTo($(this).parent().prev()); | |
$(thisAddAnchor).remove(); | |
} | |
$(this).parent().remove(); | |
}); | |
$(".forum_thumbnail_getInput").live('click',function() { | |
var $this = $(this); | |
$.get('/forum/ajaxGetThumbnailInput',function(data,status) { | |
if( status == 'success' ) { | |
$(data).appendTo($this.parent().parent()); | |
$this.remove(); | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment