The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Help! Help a Noob
OlleS
post 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>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post May 6 2016, 08:05 PM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Hej hej! laugh.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post 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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th April 2024 - 12:36 PM