如何使用JQuery设置提交按钮的文本? [英] How to set the text of a submit button using JQuery?

查看:63
本文介绍了如何使用JQuery设置提交按钮的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某些原因$("#thebutton").val("New text")不起作用.

For some reason $("#thebutton").val("New text") doesn't work.

推荐答案

这对我有用(在Chrome 4,FireFox 3.6,IE8上测试):

Well, this works for me (tested on Chrome 4, FireFox 3.6, IE8):

<html>
<head>
    <title>Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
    <script type="text/javascript">
    $(function() {
        $("#thebutton").val("New text");
    });
    </script>
</head>
<body>
    <input id="thebutton" type="submit" value="OK" />
</body>
</html>

这篇关于如何使用JQuery设置提交按钮的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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