doumu8911 2010-01-05 07:39
浏览 37


I have a div which is being populated through curl from another html page .Now the data is populating correctly but i want to use jquery or javascript on the ids or classess of the fetched data. I tried using livequery ,binding but of no use. Can you please help me .

  • 写回答

1条回答 默认 最新

  • dongzhi4498 2010-01-06 01:03

    Are you wrapping your javascript with $(document).ready(function() { } ); as to ensure the dom is fully loaded?

    For instance:

    $(document).ready(function() { $('#id').click(function() { // do stuff } ); }

    This would fix the issue if the HTML fetched via CURL is being populated via a direct post-back. If you're populating the data asynchronously, then you'll either have to use the .live() mechanism for binding (through read the docs carefully, live() doesn't work in certain scenarios and was added in the most recent version of jQuery -- so check that you've got the right version of jQuery and that you're not trying to use events that aren't supported with that binding mechanism). Furthermore, live is a bit of performance tax, so I'd do something like.

    $.ajax({ // Lots of ommitted options for simplicity's sake 
              success: function(data, status) { 
                   $('#targetDiv #elementID').click(function() { // do stuff });

    Hopefully this helps steer you in the right direction. With a code sample we could certainly help more.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥40 如果update 一个列名为参数的value
  • ¥15 基于51单片机的水位检测系统设计中LCD1602一直不显示
  • ¥15 OCS2安装出现问题,请大家给点意见
  • ¥15 ros小车启动launch文件报错
  • ¥15 vs2015到期想登陆但是登陆不上
  • ¥15 IPQ5018制作烧录固件,boot运行失败(操作系统-linux)(相关搜索:操作系统)(相关搜索:操作系统)
  • ¥20 icefall在librispeech基础上加入个人数据集
  • ¥30 keepalive高可用故障运维配置询问
  • ¥15 求帮助!国家电网内网u盘突然识别不出来了。
  • ¥15 matlab语音变速变调同时实现