从jQuery迁移到Prototype(代码片段)

时间:2011-06-08 17:38:58

标签: jquery ruby-on-rails ruby ruby-on-rails-3 prototypejs

我正在使用Ruby on Rails 3,我正在从jQuery迁移到Prototype但是我是第一个JavaScript框架的新手,所以我遇到了一些麻烦。我想编写以下Prototype代码的jQuery版本:

  page.select("#test_id").each do |element|
    element.replace( "Test text )
  end

我该怎么办?代码是什么?

1 个答案:

答案 0 :(得分:3)

$('#test_id').html('Test text');

$('.test_class').each(function(){
    $(this).html('Test text');
});