Python Forum

Full Version: How to add one more similar form by clicking on the current one using JS? Django
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It's simple. There is a form. It is necessary by clicking on it to add one more similar form. More precisely, not even by pressing, but when entering text, if there is such an opportunity in JS.

Here is the form itself.

<div class="field inline" id='specially'>
            <label for="specially" class="subhead">Special price from</label>
            {{ form.specially }}
            <span>kg</span>
            {{ form.number }}
            <span>usd</span>
</div>

<script>
$(document).ready(function() {    
  $('#specially').on('click', function(){    //here you need not click, but a function that determines text input.
    ???
  })
})
</script>
That is, the task is simple, you just need to add the same div. And there may be an infinite number of such divs. Since I don’t know JS yet, I can’t solve it myself (