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?
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.
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.
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).
The problem is the spelling of display in the line:
document.getElementById("LinkDisplay").style.display="block";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With