首页 \ 问答 \ OutputStream的flush方法什么都不做?(The flush method of OutputStream does nothing?)

OutputStream的flush方法什么都不做?(The flush method of OutputStream does nothing?)

OutputStream.flush()文档。

为什么在文档中声明OutputStreamflush方法在解释它实际上做了什么之后什么也不做? 很混乱。


From OutputStream.flush() docs.

Why does it state here in the doc that the flush method of OutputStream does nothing after explaining that it actually does something? Very confusing.


原文:https://stackoverflow.com/questions/13686265
更新时间:2023-12-13 19:12

最满意答案

注意:你真的应该问一个新的问题,不要只是复制你的旧问题,让人们跳来找出你想要的东西。

假设HTML:

<div class="wrap"><input type="file" /></div>
<span id="add-more-files">Add more</span>

你可以做:

$('#add-more-files').click(function(){
    $("<div>", {class:"wrap"}) //Create a div
        .append($("<input>", {type:'file'})) //Add an input element
        .insertBefore(this); //Insert it into the DOM
});

这将创建一个新的div和input标签结构,然后在可点击范围之前将其插入DOM。 请看这里的工作示例。

注意:它不会在同一个div中插入新输入。 如果这是你想要的,请看@ jAX的答案。


Note: You really should ask a new question, don't just copy your old one and make people jump around to figure out what you want.

Assuming the HTML:

<div class="wrap"><input type="file" /></div>
<span id="add-more-files">Add more</span>

You can do:

$('#add-more-files').click(function(){
    $("<div>", {class:"wrap"}) //Create a div
        .append($("<input>", {type:'file'})) //Add an input element
        .insertBefore(this); //Insert it into the DOM
});

This creates a new div and input tag structure and then inserts it into the DOM before the clickable span. See here for a working example.

Note: It doesn't insert a new input into the same div. If that's what you wanted see @jAX's answer.

相关问答

更多