After layui page loads ajax html assignment to encounter again pit

After the page is loaded by ajax according to the return value of the assignment is part of the html:

$(function(){

  .....

})

Direct write, error, what's $ is not defined, the reason for the dislocation jquery introduce errors.

 

layui.use ([ 'jQuery', 'Layer'], function () { 
var = $ // $ layui. focused at
, Layer = layui.layer;
// you usually just behind the same using jQuery
}); 

This call under jquery it.
However, after completion of the assignment, the page does not render

layui. Use ( 'Element', function () {
  var = layui.element Element; element.init (); // layUI Ajax loading html page when rendered, the key inserted in the html recall the specified position element.init (); rendering
});

. layui use ( 'form', function {()
  var form = layui.form; // portion form elements will be automatically modified successfully
  form.render ();
});

so rendering it, problem solved.

Guess you like

Origin www.cnblogs.com/isungge/p/11265510.html