添加< br> div标签内的标签失败 [英] Adding <br> tag inside a div tag failed

查看:211
本文介绍了添加< br> div标签内的标签失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个HTML代码:

 < div id =welcomename> 
< h1>欢迎!你叫什么名字?< / h1>
< input type =textclass =formname =nameplaceholder =您的名字在这里! ID = 名称/>
< input type =buttononclick =clicked(); value =我准备好了!/>
< / div>
< br>

这绝对完美,但我出于理由,需要< br> div'welcomename '内。
$ b 其他代码:

 < div id =hiddenDivstyle =display:none;> 
< h1 id =welcomehowareyou>你今天过得怎样?< / h1>
< form id =welcomehowareyou2method =post>
< select name =moodonchange =popup(this.options.selectedIndex)>
< option value =禁用选择>你好吗?< / option>
< option>我做得很好,谢谢!< / option>
< option>我很好,但可能会更好< / option>
< option>今天我感觉非常糟糕。< / option>
<! - < input type =submitvalue =Done!/> - >
< / form>
< p>< / p>
< / div>


解决方案

请在此处检查小提琴 - http://jsfiddle.net/ghxce8dr/
它工作正常。我为两个div都添加了< p>< / p>

 < div id =welcomename> 
< h1>欢迎!你叫什么名字?< / h1>
< input type =textclass =formname =nameplaceholder =您的名字在这里! ID = 名称/>
< input type =buttononclick =clicked(); value =我准备好了!/>
< / div>
< p>< / p>
第一次休息后的文本
< div id =hiddenDiv>
< h1 id =welcomehowareyou>你今天过得怎样?< / h1>
< select name =moodonchange =popup(this.options.selectedIndex)>
< option value =禁用选择>你好吗?< / option>
< option>我做得很好,谢谢!< / option>
< option>我很好,但可能会更好< / option>
< option>今天感觉绝对糟糕。< / option>< / select>
<! - < input type =submitvalue =Done!/> - >
< p>< / p>
第二次休息后的文本
< / div>

希望这会对您有所帮助。


I have this HTML code:

<div id="welcomename">
    <h1>Welcome! What's your name?</h1>
    <input type="text" class="form" name="name" placeholder="Your name here!" id="name"/>
    <input type="button" onclick="clicked();" value="I'm ready!"/>
</div>
<br>

That works absolutely perfectly, but I for reasons, I need that <br> inside the div 'welcomename'. When I do this though, it doesn't work.

Other code:

<div id="hiddenDiv" style="display: none;">
    <h1 id="welcomehowareyou">How are you today, ?</h1>
    <form id="welcomehowareyou2" method="post">
        <select name="mood" onchange="popup(this.options.selectedIndex)">
            <option value="" disabled selected>How are you?</option>
            <option>I'm doing great, thanks!</option>
            <option>I'm fine, but could be better</option>
            <option>I feel absolutely terrible today.</option>
            <!--<input type="submit" value="Done!"/>-->
    </form>
    <p></p>
</div>

解决方案

Please check with fiddle here - http://jsfiddle.net/ghxce8dr/ It is working fine. I added <p></p> for both div.

<div id="welcomename">
    <h1>Welcome! What's your name?</h1>
    <input type="text" class="form" name="name" placeholder="Your name here!" id="name"/>
    <input type="button" onclick="clicked();" value="I'm ready!"/>
</div>
<p></p>
Text After First Break
<div id="hiddenDiv">
    <h1 id="welcomehowareyou">How are you today, ?</h1>
    <select name="mood" onchange="popup(this.options.selectedIndex)">
            <option value="" disabled selected>How are you?</option>
            <option>I'm doing great, thanks!</option>
            <option>I'm fine, but could be better</option>
        <option>I feel absolutely terrible today.</option></select>
            <!--<input type="submit" value="Done!"/>-->    
    <p></p>
        Text After Second Break
</div>

Hope this will help you.

这篇关于添加&lt; br&gt; div标签内的标签失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆