stormtracker Posted October 13, 2019 Share Posted October 13, 2019 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> Link to comment Share on other sites More sharing options...
dsonesuk Posted October 13, 2019 Share Posted October 13, 2019 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. Link to comment Share on other sites More sharing options...
Makwana Prahlad Posted November 1, 2019 Share Posted November 1, 2019 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. Link to comment Share on other sites More sharing options...
Ingolme Posted November 3, 2019 Share Posted November 3, 2019 That code uses <font> tags, <br> tags and alert(). It is a clear example of how not to write code. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now