douxian4888 2011-10-17 23:15 采纳率: 0%
浏览 28
已采纳

Javascript / jQuery是否有内置方法或插件来检查所有表单数据的值/名称?

When using PHP and I want to find out the data being posted, I simply dump the array $_POST which will provide me with the name= attribute of all html form elements that have been submitted input, select, textarea etc, and their value= attributes in an easy to read manner.

I'm wondering if Javascript or the jQuery library has a method/plugin that does the same thing for all html form elements on the page? This would be very useful for testing out client-side validation etc.

Any answers would be greatly appreciated, as this would help me save a lot of time debugging!

  • 写回答

2条回答 默认 最新

  • dongyi8383 2011-10-17 23:18
    关注

    jQuery has the serializeArray method. If you call it on a form, you'll get a list of objects containing names and values of fields in the form.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题