Help! Help a Noob |
Help! Help a Noob |
OlleS |
May 6 2016, 11:16 AM
Post
#1
|
Group: Members Posts: 1 Joined: 6-May 16 Member No.: 24,225 |
https://gyazo.com/77426cde9a65c89424d303b4a8ef123d
Hi! I'm completely new to HTML and Javascript and i need help to "connect" a text and a button. If i click the button i want the text to hide (text) Visibility;hidden but i don't know how to do and i have searched everywere so you guys are my last hope. Here are the codes: Button: <button "type=button" "onclick = document.getElementById("Wrong").style.visibility = "hidden";" >Hej</button> Text: <div id="Wrong"></div><font color="red">Wrong Username Or Password!</font> |
CharlesEF |
May 6 2016, 05:37 PM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
You almost got it right. Since you have double quotes on the outside you need to either escape the double quotes on the inside or use single quotes instead.
CODE <button type="button" onclick = "document.getElementById('Wrong').style.visibility = 'hidden';">Hej</button> Also, your should not include the attribute name inside the double quotes.This post has been edited by CharlesEF: May 6 2016, 06:15 PM |
pandy |
May 6 2016, 08:05 PM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,734 Joined: 9-August 06 Member No.: 6 |
Hej hej!
|
Frederiek |
May 7 2016, 07:16 AM
Post
#4
|
Programming Fanatic Group: Members Posts: 5,146 Joined: 23-August 06 From: Europe Member No.: 9 |
And for the text part, put the closing div at the end, after the obsolete font tag.
|
Lo-Fi Version | Time is now: 13th May 2024 - 02:34 AM |