0
我有输入文本和按钮保存。这是元素生成服务器。我想要覆盖功能,它调用按钮保存。这是我的HTML代码的一部分:覆盖功能onclick按钮JQuery
Phone: < input type = "text"
name = "Phone"
title = "title1"
value = "(999) 999-9999" > < input class = "ms-ButtonHeightWidth"
type = "button"
target = "_self"
accesskey = "O"
onclick = "if (!PreSaveItem()) return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("
ctl00$ctl19$g_491cf573_1d26_479b_ba3e_73aecb248dcb$ctl00$toolBarTbl$RightRptControls$ctl00$ctl00$diidIOSaveItem ", "
", true, "
", "
", false, true))"
value = "Save" >
你能不能帮我写这样的jQuery的功能:我whant
<script type="text/javascript">
$(document).ready(function() {
var buttonSave = $('[value="Save"]');
var tempOnClick = buttinSave.Onclick;
buttinSave.Onclick = Validate();
function Validate() {
if ($('[title="title1"]').text.lenght == 14) {
tempOnClick.click();
} else {
alert("The field not valid!");
}
}
});
</script>
,当用户点击按钮保存,调用我的函数验证而如果输入文本框有14个符号调用默认功能。这是可能的?
你有很多错误,伙计,cmon:D'buttin'而不是'button','lenght'而不是'length'请参阅我的回答;) – Holybreath