下一个jQuery不起作用,我的代码为真 - php

我的jQuery代码不起作用,我找不到原因。该代码似乎还可以。

我的html代码

<html>
<head>
    <title>Learning Jquery</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <input type="file">
    <br />
    <input type="submit" disabled="disabled">
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="myjquery.js"></script>
</body>
</html>

javascript代码

$(document).ready(function (){
    $('input[type=file]').change(function(){
        $(this).next().removeAttr('disabled');
    });
});

参考方案

如果要启用提交按钮,请尝试以下javascript代码:

$(document).ready(function (){
    $('input[type=file]').change(function(){
        $(this).closest('form').find('[type=submit]').prop('disabled', false);
    });
});

Div单击与单选按钮相同吗? - php

有没有一种方法可以使div上的click事件与表单环境中的单选按钮相同?我只希望下面的div提交值,单选按钮很丑代码输出如下:<input id="radio-2011-06-08" value="2011-06-08" type="radio" name="radio_date&#…

使用Ajax呈现html表 - php

我想知道如何实现以下项目其实我有一个php代码,可以渲染一张桌子<table id = "oldata" class ="table table-bordered"> <thead> <tr class ="success"> <th class="…

提交表单后显示模式对话框 - php

提交下载文件后,我有一张表格。我要自动而不是自动下载文件..以显示模态对话框并显示下载链接。<form name="softwareform" id="softwareform" action="../downloadlink.php" method="POST" alig…

使用XPath在PHP中提取XML - php

我有以下XML:<root> <level name="level1"> <!-- More children <level> --> </level> <level name="level2"> <!-- Some more childre…

PHP:从函数返回值并直接回显它? - php

这可能是一个愚蠢的问题,但是……的PHPfunction get_info() { $something = "test"; return $something; } html<div class="test"><?php echo get_info(); ?></div> 有没有办…