开发者

jquery html() functions puts text on a new line

When I use the .html() function, the text is added to a newline instead of inline.

Even when I stick it in a new table cell, it always appears below row I want it.

func开发者_运维百科tion add(id)
{
    $('#d'+id).html("Loading <img src='Images/loadingGIF.gif'>");
}

HTML:

<p><input type="submit" onclick="add(25)"> <div id="d25"></div>
<p><input type="submit" onclick="add(26)"> <div id="d26"></div>

How do I get the loading message to show up on the same line as the button?


That's a property of <div> ... you can use <span> for the quickest fix


DIVs do not generally stay inline. Try replacing the div with a span. If that does not work, style the DIV like so:

display: inline;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜