Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Преобразовать JQ объект в обычный DOM (https://javascript.ru/forum/jquery/80461-preobrazovat-jq-obekt-v-obychnyjj-dom.html)

рони 08.06.2020 22:35

Цитата:

Сообщение от Белый шум
В каких случаях там будет объект jQuery?

в плагинах например.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script>
$.fn.test = function() {
    console.log(this)
};
$({}).test()

</script>


условно
$.fn.plugin = function() {
    // здесь this объект jquery
    return this.each(function() {
        //  здесь this элемент
    });
};

Белый шум 08.06.2020 23:23

рони, :thanks:


Часовой пояс GMT +3, время: 13:35.