$(function(){
$('div[onload]').trigger('onload');
});
function load(self,text) {
$(self).text(text);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div onload="load(this,'2324')">
html
</div>
<div onload="load(this,'234')">
html
</div>
<div onload="load(this,'24')">
html
</div>
<div onload="load(this,'2')">
html
</div>
在事件上添加文本的简单示例:
与功能类似
load: