1

当我为我的应用程序使用 JQuery-1.6.1 时,我有以下代码行:

$('li.step .step_type.VerifyTableContentsStep input[name*=element_name]').live('autocompletechange', buildTableContents);

在我升级到 JQuery-1.7.1 后,该行停止工作。我在文档中读到 .live() 已被弃用并改用 .on() 。我试过了,并按照文档更改了该行,使其现在是这样的:

$(document).on('autocompletechange', 'li.step .step_type.VerifyTableContentsStep input[name*=element_name]', buildTableContents);

但它仍然不起作用。有没有人有任何想法?我按照文件来信。谢谢!

更新:这是我的 .haml 代码:

.table_contents_container
  = select_tag :add_column, options_for_select(table_contents.headers_without_data.unshift(['hidden columns...'])), :class => 'add_column_selector'

  %table

    %tr
      %th.action_column
        = link_to '', '#', :class => 'sub_item_action add_column', :tabindex => 999
      - table_contents.rows.first.all_cells.each do |cells|
        %th.content_column{ :class => "#{'no_data' if cells.no_data?}", 'data-column-id' => cells.id }
          = link_to '', '#', :class => 'sub_item_action inline_delete', :tabindex => 999
          %span= cells.name
      %th  

    - table_contents.rows.each do |row|
      %tr

        %td.action_column
          - if input_elements 
            = link_to '', '#', :class => 'sub_item_action inline_add', :tabindex => 999
            = link_to '', '#', :class => 'sub_item_action inline_delete', :tabindex => 999
          - else
             

        - row.all_cells.each do |cell|
          %td.content_column{ :class => "#{'no_data' if cell.no_data?}", 'data-column-id' => cell.id }
            - if input_elements 
              = text_field_tag "step[table_contents][][#{cell.id}]", cell.value, :onfocus =>"if(this.value=='Table Value...') this.value='';",:placeholder => 'Table Value...', :onblur => "if(this.value=='') this.value='Table Value...'", :disabled => cell.no_data?
            - else
              = h ParsedLine.new(cell.value).result

        %td  
4

0 回答 0