Custom Validation using jquery
<p>I have two input field. one with name and other is verify name. I want to add some validation into it. If my first input contains 'robert' then user only can type "robert" in next field. But it is not giving me the desire result</p>

<pre><code>&lt;head&gt;
&lt;script type="text/javascript"&gt;
$(function(){
var jn= [];
$('#first').keypress(function(e){
var d= e.charCode || e.keyCode;
jn.push(d)})

var jm=[];      
$('#second').keypress(function(e){
var f= e.charCode || e.keyCode;
jm.push(f)
for(i=0;i&lt;jn.length;i++){
for(z=0;z&lt;jm.length;z++)
{
if(jn[i]==jm[z]){
alert('hiii')}}}})
})
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
name
&lt;input type="text" id="first" /&gt;
verify name
&lt;input type="text" id="second" /&gt;
    &lt;/body&gt;
</code></pre>
