I have a script where I create an input element. How can I put require inside it? and what is the difference between setting an input and making it variable and append it to a div and still put an attribute required?
Javascript code:
$("#myVar").append(
'<input name="name" class="myClass">');
JQuery code:
var input = $('<input>', { id: myID', name: 'name', type: 'text', class: 'myClass', focusin: function() { $(this).val(''); } }).appendTo('#myVar'); ?
I found a post just like this and I found this useful for me. How should I required this? attribute doesn't work
HTML:
<div id="myVar"></div>