Jump to content
stormtracker

howto give html 5 form and id

Recommended Posts

Hello how can I give this form and id, when you submit the form button the contacts will show up in <div id="show"></div> and thankyou

    <section id="weather">
        <div class="container">
            <h1>Search The Weather</h1>
            <form">
                <input type="text" id="city" placeholder="Search City..."><!--Give id -->
                <button type="submit" id="#submitWeather" class="button_1">Submit Request</button><!--Give id -->
                <span id="#warning"></span>
        </div>
      </form>
	</section>

 

Share this post


Link to post
Share on other sites

Probably server language like php, probably with database mysql, probably with javascript OR a mixture of ALL! Probably. Depends WHERE this information is coming from.

Share this post


Link to post
Share on other sites

Hello, @stormtracker

Please try this code :

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">

</head>
<body>
<section id="weather">
        <div class="container">
            <h1>Search The Weather</h1>
            <form action="#">
                <input type="text" id="city" placeholder="Search City..."><!--Give id -->
                <button type="button" id="#submitWeather" onclick="Show()" class="button_1">Submit Request</button><!--Give id -->
                <span id="#warning"></span>
        
      </form>
      </div>
      <br><br><br>
      <div id="Show">
      
      </div>
	</section>
	
	
	<script>
    document.getElementById("Show").style.visibility="hidden";
    function Show()
    {
    	if(document.getElementById('city').value == '')
        {
            alert("Please Enter Text In Text Box");
        	document.getElementById("Show").style.visibility="hidden";
        }
        else
        {
        	document.getElementById("Show").style.visibility="visible";
        	document.getElementById("Show").innerHTML = "Hello ! <font size='+2'>" + document.getElementById('city').value + "</font>";
        }
    }
    </script>
</body>
</html>

I hope above code will be useful for you.
Thank you.
 

Share this post


Link to post
Share on other sites

That code uses <font> tags, <br> tags and alert(). It is a clear example of how not to write code.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...