<div>
  <div class="ni_con">
    <%= form_tag(apply_for_resource_user_path(:id => User.current.id, :attachment_id => attachment.id), :multipart => true, :remote => true, :name=>"apply_for_homework_form", :id=>'apply_for_homework_form') do %>
        <h2>申请分享</h2>
        <p style="color: #000;">
          申请说明（必选）：
          <textarea type="text" name="content" id="apply_content" placeholder="请附言，以增加分享的成功机率。" class="apply_content mt10" style="outline:none;"></textarea>
        </p>
        <span class="c_red ml5 f12" style="display: none" id="apply_content_notice">为增加分享的成功机率，请务必填写申请说明。</span>
        <div class="ni_btn">
          <a href="javascript:" class="tijiao" onclick="submit_apply_resource();" style="margin-bottom: 20px; margin-left: 60px; color: #fff">
            确&nbsp;&nbsp;定
          </a>
        </div>
    <% end %>
  </div>
</div>
<script type="application/javascript">
    var first_click_apply = true;
    function submit_apply_resource(){
        if($.trim($("#apply_content").val()) == ""){
            $("#apply_content_notice").show();
        } else if(first_click_apply) {
            first_click_apply = false;
            $('#apply_for_homework_form').submit();
        }
    }
</script>