Skip to content

Instantly share code, notes, and snippets.

@alice1017
Created December 8, 2011 15:53
Show Gist options
  • Save alice1017/1447401 to your computer and use it in GitHub Desktop.
Save alice1017/1447401 to your computer and use it in GitHub Desktop.
showbox.js
$(function(){
$("span#search_box").click(
function(){
if ($("span#search").css("display") == "none"){
$("span#search").slideDown("nomal");
}
else {
$("span#search").slideUp("nomal");
}
});
function smaplefunc(selector, tag_html){
selector.parent().remove();
}
$("span.input").click(function(){
var query = $("<input>").attr("type","text").attr("class","input-tag")
var s_val = $("<input>").attr("type","hidden").attr("value",$(this).parent().parent().parent().next().next().attr("status_id"));
var put = $("<input>").attr("type","submit").attr("class","add-tag").attr("value","タグを追加");
var caution = $("<span>").attr("class","caution").text("タグは半角スペースで区切ってください。大文字は小文字になります");
$(this).parent().prepend(query).append(s_val).append(put).append(caution);
$(this).remove();
$("input.add-tag").click(function(){
var query = $(this).prev().prev().val();
var status_id = $(this).parent().parent().parent().next().next().attr("status_id");
$.ajax({
type:"GET",
url :"/api/tag",
data:"query="+query+"&status="+status_id,
success:function(tag_html){
//$(this).prev().prev().remove();
//$(this).prev().remove();
//$(this).next().remove();
//$(this).append(tag_html);
}
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment