最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Prototype.js shortcut for getting value of an element? - Stack Overflow

programmeradmin0浏览0评论

I didn't use Prototype.js before, when I use jquery, I can get an element value like $("#inputA").val(); Is there an equivalent method in prototype like this? I use $("inputA").getAttribute('value');, which is very verbose.

I didn't use Prototype.js before, when I use jquery, I can get an element value like $("#inputA").val(); Is there an equivalent method in prototype like this? I use $("inputA").getAttribute('value');, which is very verbose.

Share Improve this question edited Dec 27, 2011 at 16:29 Rob W 349k87 gold badges807 silver badges682 bronze badges asked Apr 27, 2010 at 13:41 SawyerSawyer 15.9k28 gold badges91 silver badges126 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 5

document.getElementById("inputA").value is like magic: it works in EVERY framework.

use getValue or $F(element) construct

$F('elementId') is one way. That's problematic for radio buttons. I haven't used Prototype in a while however so maybe there's something new.

var x = $('inputA').value;

发布评论

评论列表(0)

  1. 暂无评论