admin管理员组文章数量:1392086
First, i have a code that i need to know if the user has clicked on one submit button, then, i need one function to enable another submit button that is disabled by disabled="disabled".
Here's my noob function (Needs improves, does not work). :
<script>
function EnableSend() {
if(document.getElementById("Submit_Facebook").click(); {
document.getElementById("submit").disabled = false; }
}
</script>
And now the code:
1 - Disabled Submit: (Will be enabled after user click on Submit_Facebook submit button).
<input id="submit" name="submit" type="submit" value="" disabled="disabled">
2 - Other submit that will make the disabled submit enabled.
<form method="post" class="button" action="<?=$PHP_SELF;?>"">
<input id="Submit_Facebook" name="Submit_Facebook" type="submit" value=""onclick="EnableSend()">
</form>
3 - Php part
<?php
if (isset($_POST['Submit_Facebook'])) {
echo "<script>alert('You now can proceed to step two.');</script>";
echo '<script type="text/javascript"language="javascript">window.open("#");</script>';
exit;
}?>
Well, my english is not that good, but if you guys need any detail just contact me, thanks for your attention.
First, i have a code that i need to know if the user has clicked on one submit button, then, i need one function to enable another submit button that is disabled by disabled="disabled".
Here's my noob function (Needs improves, does not work). :
<script>
function EnableSend() {
if(document.getElementById("Submit_Facebook").click(); {
document.getElementById("submit").disabled = false; }
}
</script>
And now the code:
1 - Disabled Submit: (Will be enabled after user click on Submit_Facebook submit button).
<input id="submit" name="submit" type="submit" value="" disabled="disabled">
2 - Other submit that will make the disabled submit enabled.
<form method="post" class="button" action="<?=$PHP_SELF;?>"">
<input id="Submit_Facebook" name="Submit_Facebook" type="submit" value=""onclick="EnableSend()">
</form>
3 - Php part
<?php
if (isset($_POST['Submit_Facebook'])) {
echo "<script>alert('You now can proceed to step two.');</script>";
echo '<script type="text/javascript"language="javascript">window.open("#");</script>';
exit;
}?>
Well, my english is not that good, but if you guys need any detail just contact me, thanks for your attention.
Share Improve this question edited May 19, 2014 at 18:40 Jonas Schäfer 20.8k5 gold badges59 silver badges70 bronze badges asked May 19, 2014 at 18:37 KareninaKarenina 491 silver badge3 bronze badges 4- 1 what are you doing in that function looks weird – Susheel Singh Commented May 19, 2014 at 18:43
-
the
.click()
in javascript simulates a mouse click, not to be confused with jQuery's click method which attaches an event listener. So wrapping it in a if won't really help you here. – Ballbin Commented May 19, 2014 at 18:49 -
@Jack_of_All_Trades - If removes the semicolon the OP will still have a broken
if
statement. They would have to replace ';' with ')'. – Ballbin Commented May 19, 2014 at 18:50 - @Ballbin: yes, you are right. – Jack_of_All_Trades Commented May 19, 2014 at 18:51
2 Answers
Reset to default 2jsFiddle
<input id="submit" name="submit" type="submit" value="send" disabled="disabled">
<input id="Submit_Facebook" name="Submit_Facebook" type="submit" value="" onclick="EnableSend();">
<script type="text/javascript">
function EnableSend() {
document.getElementById("submit").disabled = false;
}
</script>
You got to remove disabled
attribute from input.
Something like this:
var EnableSend = function(){
$( "#submit" ).removeAttr('disabled');
};
本文标签: phpEnable submit button with javascriptStack Overflow
版权声明:本文标题:php - Enable submit button with javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744780883a2624705.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论