0

I still have some problem. In my HTML code I set one DIV to be hidden.

<div id="personalProfileWrap" style="visibility: hidden">

I changed several times my method in java script and it can be removed this attributed. These are the functions I have tried:

var div = document.getElementById("personalProfileWrap");
div.setAttribute("style", "");
//$("#personalProfileWrap").removeAttr("style");

I also tested with Dom getElement and still does not work. Don't know where the problem is.

Please for advise.

4
  • It works see here: jsfiddle.net/ZzEjL Commented Apr 7, 2014 at 20:52
  • $("#personalProfileWrap").removeAttr("style"); should work - w3schools.com/jquery/… Commented Apr 7, 2014 at 20:52
  • jsFiddle demo for comment of @user3388636... Commented Apr 7, 2014 at 20:58
  • Why did you tag this "jquery"? Commented Apr 7, 2014 at 21:00

2 Answers 2

3

It's a simple document.getElementById("personalProfileWrap").removeAttribute("style");

You don't even need jQuery for it. If you only want to remove one or two items, you'll have to do a .getAttribute("style") first, and parse through the set styles (semicolon delimiter), remove the one you want, and then do a .setAttribute("style", newStyleString).

Sign up to request clarification or add additional context in comments.

Comments

0

The following works for me with jQuery:

$("#personalProfileWrap").css("visibility", "inherit");

Here my (short) jsFiddle demo

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.