Ben 2 mobil number.I şey denedim ve çalışıyor aynı olmamalıdır iki alan cep telefonu numarası ve alternatif mobil number.need java script validation.1st numarası var. Doğru cevabı olan bu html kodu sorumu düzenlendi:
<div style=color:red class=col-sm-3><input type=text class=form-control id=mbno placeholder=Mobile name=mbno maxlength=13 required /></div>
<div style=color:red class=col-sm-3><input type=text class=form-control id=altmbno placeholder=Alternate Mobile name=altmbno maxlength=13 />
<script type=text/javascript>
$.validator.addMethod(mobile_not_same, function(value, element) { // Method to check if 2 mobile numbers are same or not
return $('#mbno').val() != $('#altmbno').val() // mbno and altmbno are input id's
});
$(function(){
$(#save).prop('disabled', true);
// validate signup form on keyup and submit
$(#defaultForm).validate({ // defaultForm is a form id
rules: {
altmbno: {
required: true,
number : true,
mobile_not_same: true,
minlength: 10
},
mbno: {
required: true,
number : true,
mobile_not_same: true,
minlength: 10
},
},
messages: {
mbno: {
required: Please enter 10 digitsmobile number !,
mobile_not_same: mobile numbers should not be same,
},
altmbno: {
required: Please enter 10 digitsmobile number !,
mobile_not_same: mobile numbers should not be same,
},
}
})
});
</script>