I want to add a - dash after user has typed the first three numbers and then another dash after they typed another 4 numbers and append it back to the input text "#phone_number". Something like this, with maybe jquery preferably or javascript
<input type="text" name="phone_number" id="phone_number" value="" onkeyup="setnumberformatautomatically()" placeholder="Phone number here">
Lets Assume the USER typed 08012345678 it should turn to something like this 080-1234-5678 automatcially when the user is typing.
Then the JS
<script>
function setnumberformatautomatically(){
var phone_line = $("#phone_number").val();
//how do i go about this here please.
}
</scrript>