I don`t find out how to get the value from the js script input ( phone number that user input , and the country prefix code that the script auto put )
<script src="{% static 'assets/js/intlTelInput.js' %}"></script>
<script>
var input = document.querySelector("#phone");
window.intlTelInput(input, {
initialCountry: "gb",
});
</script>
and have it saved thru my HTML form under this:
<input type="tel" name="phone-number" class="form-control input-style" placeholder="your phone">
<input type="tel" id="phone">
Full code :
<form class="submit-form" method="post" action="{% url 'register' %}" enctype="application/json">
{% csrf_token %}
<div class="div-block">
<div class="double-fields-step-2-only">
<div class="form-group">
<div class="form-group right">
<input type="tel" name="phone-number" class="form-control input-style" placeholder="your phone">
<input type="tel" id="phone">
<script src="{% static 'assets/js/intlTelInput.js' %}"></script>
<script>
var input = document.querySelector("#phone");
window.intlTelInput(input, {
initialCountry: "gb",
});
</script>
<div class="icon"></div>
</div>
</div>
<button type="submit" class="btn btn-register" data-title="Loading...">
Register
</button>
</form></div>
</form>