Here is the scenario…
I’m initially hiding an element(s) in css using **display: none**. I then use jQuery to make the element(s) visible by using **.show()**. By default the .show() method will make elements **display: block**. I need the elements to be **display: inline-block**. As a result I came up with the following methods to .show() inline-block elements. I prefer the first method, but I’m wondering if there’s best practice for doing this?
**Method 1 (Preferred)**
$.fn.showInBlock = function () {
return this.css(‘display’, ‘inline-block’);
};
In action…
$(‘#element’).showInBlock(0);
**Method 2**
var showInBlock = function (){
$(this).css(‘display’, ‘inline-block’);
};
**Method 3**
function showInBlock() {
$(this).css(‘display’, ‘inline-block’);
}
Any suggestions are welcome…Thank You.