Download and include this plugin
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js"></script>
and use like
if(CryptoJS.MD5($("#txtOldPassword").val())) != oldPassword) {
}
//Following lines shows md5 value
//var hash = CryptoJS.MD5("Message");
//alert(hash);