如何获取DOM解析器等待脚本在解析数据之前运行 [英] How To Get DOM Parser To Wait For Scripts To Run Before Parsing Data

查看:140
本文介绍了如何获取DOM解析器等待脚本在解析数据之前运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了一个html表的页面,它使用tablesorter,并且被分类为onload。我想要我的dom解析器脚本从这个表中获取排序后的行。现在,它正在跳过排序并抓取行。

解决方案

使用sortEnd事件

  $(document).ready(function(){
//调用tablesorter插件,魔术发生在标记
$( table)。tablesorter();
//分配sortStart事件
$(table)。bind(sortStart,function(){
//当sort(sortEnd,function(){
//排序结束时的东西
});
});


Ive got a page with an html table that uses tablesorter and is sorted onload. I want my dom parser script to grab the rows from this table only after it has been sorted. Right now it is skipping the sort and grabbing the rows before.

解决方案

Use the sortEnd event

$(document).ready(function() { 
    // call the tablesorter plugin, the magic happens in the markup 
    $("table").tablesorter(); 
    //assign the sortStart event 
    $("table").bind("sortStart",function() { 
        // Do stuff when the sorting begin
    }).bind("sortEnd",function() { 
        // To stuff when the sorting ends
    }); 
}); 

这篇关于如何获取DOM解析器等待脚本在解析数据之前运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆