jQuery addClass example

Change class name on click in jQuery

by yelog yelog

HTML

<script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
<button id='open'>
打开layer
</button>

JavaScript

// handle click and add class
$("#open").on("click", function(){
  var index = layer.open({
  type: 2,
  content: 'https://www.layui.com'
});
$('#layui-layer-iframe'+index+' ').css('background', '#393D49')
})