Welcome! What your name?

Failed to add tag in div tag

I have this HTML code:

<div id="welcomename">
    <h1>Welcome! What 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>

      

It works absolutely fine, but for reasons I need to get <br>

inside div 'welcomename

. ”When I do this, it doesn't work.

Another 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>

      

+3


source to share


2 answers


Please check the fiddle here - http://jsfiddle.net/ghxce8dr/ It works fine. I added <p></p>

for both divs.

<div id="welcomename">
    <h1>Welcome! What 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 helps you.

+1


source


Are you adding "br" just before the closing div and after the input element? This is because the input element is an inline element.



+3


source







All Articles