I am create a currency selector form and submitting it by js . But i am not able to submit . below is the code. Can anyone help? I donot want to use submit button in this .
Form code:
{% form 'currency' %}
{% for currency in shop.enabled_currencies %}
{% if forloop.first == true %} <span> {{currency.iso_code}} {{currency.symbol}} </span>
</span>
<div>
<ul class="-ml-4 py-2">
{% endif %}
<li value = "{{currency.iso_code}}">{{currency.iso_code}}</li>
{% endfor %}
</ul>
</div>
{% endform %}
js:
<script>
$( document ).ready(function() {
$('.shopify-currency-form li').on('click', function() {
$(this).addClass('selected').siblings().removeClass('selected');
$(this).attr("name","currency");
$(this).parents('form').submit();
});
});
</script>