F
F
fsamorodov2015-11-04 21:29:09
Ember.js
fsamorodov, 2015-11-04 21:29:09

How to use $(window).load(function(){} in emberjs?

Hello! The question for emberjs 2.1 is the following:
There is some code in the js file that does not want to work in any way.

$(window).load(function(){
    $(".scrollers").mCustomScrollbar();
    $('select').styler();
    console.log($('#gender input').val()) // undefined! Хотя по факту 'man'
});

Apparently the DOM is loaded later than window.load starts, and maybe some other feature.
Tell me how to solve this problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Romanov, 2015-11-04
@fsamorodov

You can use the ready event , but this is a clumsy way.
It is more correct to make components and execute mCustomScrollbar and styler inside them.

F
fsamorodov, 2015-11-05
@fsamorodov

$('select').styler();called on almost every page.
Those. do I need to call the function separately for each page, in the components?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question