使用Mootools将提交按钮替换为链接

Using Mootools to replace submit buttons with links

本文关键字:替换 链接 按钮 提交 Mootools 使用      更新时间:2023-09-26

对于特定的工作,我必须使用mootools(我习惯使用jQuery)。我的问题是,用inline_submit

类替换所有提交按钮最有效的方法是什么?
<input type="submit" class="inline_submit" name="change1" value="Change This" />

的链接形式为

<a href="#change1" rel="handleinline">Change This</a>

其中的href =到原始提交的名称?

$$('input[type="submit"].inline_submit').each(function(el){
  new Element('a', { rel : 'handleinline' , href : '#'+el.get('name')})
    .set('text', el.get('value'))
    .replaces(el);
});

演示:http://jsfiddle.net/steweb/PJ63G/

文档:

  • http://mootools.net/docs/core/Element/Element
  • http://mootools.net/docs/core/Element/Element元素:替换