How to avoid automatic focus on first input field when popping a HTML form as a JQuery dialog?

What I did was I created an extra input and made it invisible (style=”display:none”) then gave it the property autofocus=”true” put this at the end of your dialog content so it wont mess with anything. it should look like this: <div><!–dialog div–> <button></button> <button></button> <input type=”hidden” autofocus=”true” /> </div>

How to display file name for custom styled input file using jquery?

You have to bind and trigger the change event on the [type=file] element and read the files name as: $(‘#file-upload’).change(function() { var i = $(this).prev(‘label’).clone(); var file = $(‘#file-upload’)[0].files[0].name; $(this).prev(‘label’).text(file); }); .custom-file-upload { border: 1px solid #ccc; display: inline-block; padding: 6px 12px; cursor: pointer; } <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <form> <label for=”file-upload” class=”custom-file-upload”> <i class=”fa fa-cloud-upload”></i> Upload … Read more

What is the correct readonly attribute syntax for input text elements?

HTML5 spec: http://www.w3.org/TR/html5/forms.html#attr-input-readonly : The readonly attribute is a boolean attribute http://www.w3.org/TR/html5/infrastructure.html#boolean-attributes : The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. If the attribute is present, its value must either be the empty string or a value that is an … Read more