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