jQuery简单的值得到.val()的问题 [英] jQuery simple value get issue with .val()

查看:74
本文介绍了jQuery简单的值得到.val()的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $('。document')。ready(function(){
alert($('font.someClass')。val());
});

这是

有人知道我为什么不能返回字体标签的值吗?



我假设您不允许调用该值或设置字体标记的值。

解决方案

.text()不是 .val() - .val ()用于表单元素。


I have the following code:

$('.document').ready(function(){
   alert($('font.someClass').val());
});

Here is a Fiddle with it.

Does anyone know why I can not return the value of a font tag?

Am I to assume that you are not allowed to call the value or set the value of a font tag.

解决方案

.text() not .val() - .val() is for form elements.

这篇关于jQuery简单的值得到.val()的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆