Note : put this code in skin/frontend/default/your_theme/js/ your_theme /opc/checkout.js
In billing.phtml -> paste below code in billing.phtml at just below at already had email field. Then open validation.js which is located at js/prototype/validation.jsand paste below code at just below the line => return !(pass.length < 7)
We need to write jquery sometimes in phtml file for special requirement. For that you need to define jquery in require function in script tag for using jquery within phtml file.Put below script in phtml file and replace console.log with your custom code.
Replacing some specific string from url is somewhat tricky job we need to do in our day to day life in IT field for making something dynamic. Here is the working solution you can try given below. Above given solution is tried and found working. If you are stuck somewhere then feel free to comment
Set interval is very important method, which is simultaneously checks for the element if the element is exists or not. It is invoke to the time you provided in interval function, And it will continue to invoke till then the element is not found.