3
<form id="form1" method = "post">
Text1:<input type ="text" id="textname1"/><br>
<input type ="button" name="button2" id="button2" value="UPDATE">
</form>
<script type ="text/javascript">
$(document).ready(function() {
$("#button2").click(function(e){
alert($("#textname1").attr('value').replace('-',''));
});
$("#textname1").datepicker();
$("#textname1").datepicker("option", "dateFormat", 'yy-mm-dd');
});
</script>
假设我在字段中输入日期2010-07-06。当我单击button2时,我得到的警报为201007-06.How can replace the last连字符( - )替换字符串中一个字符的多个实例
当我更换IAM消力越来越日期为“2010-07-07'.I要替换连字符 – Someone 2010-07-23 16:11:02
@Someone:你必须删除从正则表达式引号:'。替换(/ -/g,''))' – 2010-07-23 16:11:38
@someone尝试使用正确的示例 – 2010-07-23 16:12:10