Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the style display from none to block in javascript?

Here is html code snippet

<li style="opacity: 1;">
    <a id="LinkDisplay" class="optionsDropDown" style="color:#FF0000;display:none" href="javascript:showThisLink('LinkId');">
</li>

Here is jquery function which is being called at on load

$(function () {
    $.ajax({
        url: url,
        dataType: 'json',
        data: '',
        type: 'POST',
        success: function (data) {
            alert("Test");
            document.getElementById("LinkDisplay").style.diplay="block"; // line 1
            // after this line execution i should see the link as i have
            // changed the link display from none to block but it is still invisible
        });
    });
}

After line 1 execution , I am not sure why my link is not becoming visible?

like image 242
M Sach Avatar asked Aug 29 '12 08:08

M Sach


People also ask

How do I change display none to block?

Answer: Use the jQuery css() Method You can use the jQuery css() method to change the CSS display property value to none or block or any other value. The css() method apply style rules directly to the elements i.e. inline.

What is style display block in JavaScript?

Definition and Usage A block element fills the entire line, and nothing can be displayed on its left or right side. The display property also allows the author to show or hide an element. It is similar to the visibility property.

What is block and none in JavaScript?

A block has some whitespace above and below it and tolerates no HTML elements next to it, except when ordered otherwise (by adding a float declaration to another element, for instance). display: none. display: none means that the element is not displayed at all (so you won't see it in the example either).


1 Answers

The problem is the spelling of display in the line:

document.getElementById("LinkDisplay").style.display="block";
like image 190
Prasad DLV Avatar answered Oct 07 '22 22:10

Prasad DLV