diff options
author | Sarven Capadisli <csarven@controlyourself.ca> | 2009-06-25 21:01:07 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@controlyourself.ca> | 2009-06-25 21:01:07 +0000 |
commit | 6a0571d51b0cafb0dbc7caf3aa61cdfd17d6c7ce (patch) | |
tree | 0097a5ba2e7572f02c87d3bf1ff5cda4dd72f783 /js | |
parent | d1d5347ba3a567205fef36633b52f19a24485a42 (diff) |
Added functionality to remove the notice data attachment
Diffstat (limited to 'js')
-rw-r--r-- | js/util.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/js/util.js b/js/util.js index 9156045bb..e7c54b74a 100644 --- a/js/util.js +++ b/js/util.js @@ -222,6 +222,7 @@ $(document).ready(function(){ } $("#notice_data-text").val(""); $("#notice_data-attach").val(""); + $('#notice_data-attach_selected').remove(); counter(); } $("#form_notice").removeClass("processing"); @@ -233,7 +234,7 @@ $(document).ready(function(){ $("#form_notice").each(addAjaxHidden); NoticeReply(); NoticeAttachments(); - NoticeDataAttachSelected(); + NoticeDataAttach(); }); function NoticeReply() { @@ -312,10 +313,15 @@ function NoticeAttachments() { ); } -function NoticeDataAttachSelected() { - $('#notice_data-attach').change(function() { - S = '<div id="notice_data-attach_selected" class="success">'+$(this).val()+'</div>'; +function NoticeDataAttach() { + NDA = $('#notice_data-attach'); + NDA.change(function() { + S = '<div id="notice_data-attach_selected" class="success"><code>'+$(this).val()+'</code> <button>×</button></div>'; NDAS = $('#notice_data-attach_selected'); (NDAS.length > 0) ? NDAS.replaceWith(S) : $('#form_notice').append(S); + $('#notice_data-attach_selected button').click(function(){ + $('#notice_data-attach_selected').remove(); + NDA.val(''); + }); }); } |