Is there any specific reason behind using $ with variable in jQuery

后端 未结 6 563
天涯浪人
天涯浪人 2020-11-27 16:10

I know it\'s a silly question but I am a bit confused with this. For example, if I have an input with an ID: rad1, is there any difference between below lines o

6条回答
  •  失恋的感觉
    2020-11-27 16:21

    A composition also works fine:

    You can also do something like this to show a

    :

    function getCompTable(divId){
      var $d = $('#' + divId);
      $d.show();
    }
    

    USAGE

    getCompTable('compListDiv'); // compListDiv - is a div id=""
    

    Yosi Lev

提交回复
热议问题