jQuery appear() and show() methods difference?

11,158

Show is a function to show a selected element. e.g:

<i id='element' style='display:none;'></i>

to show hidden element

$('#element').show()

As Jquery says disappear/appear is a custom event you can fire once the element is shown. so it should look something like -

$('#element').appear(function() {
  ... code goes here
});

For jQuery reference show - http://api.jquery.com/show/ appear/disappear - https://plugins.jquery.com/appear/

Edit - i think it's also safe to say that show is packed with options and a 'complete' callback which is fired once the element has finished shown.

Share:
11,158
kernal_lora
Author by

kernal_lora

Research is what I'm doing when I don't know what I'm doing. That's what I Love Research and Development. Believe me.. Describe myself in one word is a tough one !! really can’t do that, it is very hard to describe myself. Infact I am still getting to know myself !! But one thing I am not like you and you also not like me. Talk to me then you will get to know. Enjoying the learning curve...... ;-) Read more about me here --&gt; https://udayappam.github.io/

Updated on August 23, 2022

Comments

  • kernal_lora
    kernal_lora over 1 year

    I'm studying for a HTML, CSS, JS exam and found various resources to help me study. In doing a practice quiz, I found this question.

    You are creating a page that contains detailed employee information for a company portal. The page uses a jQuery library. The page contains a hidden button named btnEdit that is defined by the following code.

    <button id="btnEdit" style="display: none;">Edit</button>
    

    The button is not displayed by default. The button must be displayed only if the user is logged on. You need to add code to the document.ready() function to meet the requirements for the button. Which line of code should you use?

    A. $ ('#btnEdit').appear();
    B. $ ('#btnEdit').visible = true;
    C. $ ('#btnEdit').show();
    D. $ ('#btnEdit').Visible();
    

    The quiz telling me that option A is correct. I haven't use appear() method before.

    My question is:

    1. .appear(), Is this function really as a part of jQuery library? I could not find .appear() function in jQuery doc. No results in jQuery API

    2. Is that option A is correct? If it is correct can anyone tell me why? As of my conscience option C is correct(If I'm wrong correct me).

    3. Can anyone please tell me difference between appear() and show()? And when to use appear(), when to use show()?