You can try like this
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
function CheckValidation() {
$('#Error_pspan').html("");
if($('#password').val()!=$('#cpassword').val())
{
$('#Error_pspan').html("Password and Confirm Password are not matched");
$('#password').focus();
return false;
}
}
</script>
<b>Password:</b><input type="password" name="password" id="password" /><br/>
<span id="Error_pspan" style="color:Red; font-size:12px; font-weight:bolder;"></span><br/>
<b>Confirm Password:</b><input type="password" name="cpassword" id="cpassword" /><br/>
<button type="Button" onclick="return CheckValidation(this);">Save</button>