Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8327527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:08:28+00:00 2026-06-09T01:08:28+00:00

i have a small problem in my code when i try to update the

  • 0

i have a small problem in my code when i try to update the value in the variable “a” to class attribute of label tag. Can anyone help me out. here is my code

<html>
<head>
<style>
label.visible {visibility:visible}
label.hidden {visibility:hidden}
</style>
<script type="text/javascript">
var a;
function doset()
{
a="hidden";
alert(a);
return a;
}
</script>
</head>
<body>
<form>
<label class=visible>Hello</label>
<button onclick="doset()">v</button><br>
<label class=a>Hello1</label><br>
<label class=a>Hello2</label><br>
<label class=a>Hello3</label><br>
<label class=a>Hello4</label><br>
<label class=a>Hello5</label><br>
</form>
</body>
</html>

Here is the fiddle : http://jsfiddle.net/M8CXN/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:08:30+00:00Added an answer on June 9, 2026 at 1:08 am

    class=a

    This does not bind the class name to the javascript global variable a; they are different things in different contexts.

    If you want to manipulate classes you must do so via the DOM. The simplest way is to use a container;

    <div id="myItems">
       <label>Hello1</label><br>
       <label>Hello2</label><br>
       ...
    

    and

    function doset() {
       a="hidden";
       document.getElementById("myItems").style.visibility = a;   
       alert(a);
    }
    

    called with

    <button onclick="doset(); return false;">v</button><br>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have small problem. I learn java SE and find class ClassLoader. I try
Im having a small problem with my code. I have been trying to read
Here a small piece of code for testing and explain the problem. I have
have small problem, and would very much appreciate help :) I should convert byte
I have a small problem which i can't seem to figure out. I tried
I have a small problem which i can't seem to solve myself. Look at
I have small problem with simple code. This code is working properly on x86
I have a small Problem using reg. expressions with scanner here's the code: String
I have a small problem with android maps. I added an ItemizedOverlay class to
I have a small problem in my code. I have the following code: import

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.