实训项目序号只能输入数字或复制数字

This commit is contained in:
daiao 2017-02-24 20:14:20 +08:00
parent e3d0551e51
commit 2aabaca9b6
1 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<ul>
<li class="clear">
<label class="label"><span class="c_red f12">*</span>&nbsp;序号&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :position, :no_label => true, :placeholder => "请输入序号(整数)", :onkeyup => "this.value=this.value.replace(/\D/g,'')", :onafterpaste => "this.value=this.value.replace(/\D/g,'')" %>
<%= f.text_field :position, :no_label => true, :placeholder => "请输入序号(整数)" %>
</li>
<li class="clear">
<label class="label"><span class="c_red f12">*</span>&nbsp;标题&nbsp;&nbsp;:&nbsp;</label>
@ -41,9 +41,17 @@
<input onclick="issue_create();" class="sy_btn_blue mr5 fr" onfocus="this.blur()" id="issue_confirm" style="width: 28px;color: #FFF" value="保存">
</li>
</ul>
<script>
<script type="text/javascript">
function issue_create(){
training_task_desc_editor.sync();
$('#project_training_form').submit();
}
$(function(){
$("#training_task_position").bind('keyup', function (){
this.value=this.value.replace(/\D/g,'')
});
$("#training_task_position").bind('afterpaste',function(){
this.value=this.value.replace(/\D/g,'')
});
});
</script>