如何添加新的inpu時關閉焦點?我想這樣做,因爲當我在我的iPad上,然後按「添加字段」它會自動彈出鍵盤。這非常煩人,因爲有時我想在輸入數據之前添加一些新的輸入字段。如何添加新的輸入類型時關閉焦點?
\t \t $('.multi-field-wrapper').each(function() {
\t \t \t var $wrapper = $('.multi-fields', this);
\t \t \t $(".add-field", $(this)).click(function(e) {
\t \t \t \t $('.multi-field:first-child', $wrapper).clone(true).appendTo($wrapper).find('input').val('').focus();
\t \t \t });
\t \t \t $('.multi-field .remove-field', $wrapper).click(function() {
\t \t \t \t if ($('.multi-field', $wrapper).length > 1)
\t \t \t \t \t $(this).parent('.multi-field').remove();
\t \t \t });
\t \t });
\t \t \t
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form action="" method="POST" style="height:50px;">
<input type="submit" name="stocksave" value="Save" class="float" style = "float:right;">
</br></br>
\t
<div class="multi-field-wrapper focusoff">
\t <div class="multi-fields focusoff">
\t \t <div class="multi-field focusoff">
\t \t \t <input type="text" name="stockitem[]" autocomplete="off" class="focusoff">
\t \t \t <select name='piecesdd[]' style='width:150px; '>
\t \t \t
\t \t \t <option value='0'>PIECES</option>
\t \t \t <?php
\t \t \t \t $count = 1;
\t \t \t \t while ($count<=100) {
\t \t \t \t \t echo "<option value='".$count."'>".$count."</option>";
\t \t \t \t \t $count++;
\t \t \t \t };
\t \t \t \t ?>
\t \t \t </select>
\t \t \t <button type="button" class="remove-field">Remove</button>
\t \t \t
\t \t \t <button type="button" class="add-field">Add field</button>
\t \t \t
\t \t </div>
\t \t
\t </div>
\t </div>
\t
</form>
你不想把重點新添加的元素然後?! –