在提交表单之前,提交的文本将是可编辑的?
<div class="container">
<form method="POST" name="requests" id="signup">
<input type="text" id="txtTitle" name="txtTitle" placeholder="Enter Your Description" required="" value="<?php if (isset($_POST['txtTitle'])) { echo $_POST['txtTitle'];}?>" >
<button type="submit" value='Submit' class="sendButton" name="submit" id='submitme'>Submit</button>
</form>
</div>
答案 0 :(得分:-1)
只需使用readonly
。
<div class="container">
<form method="POST" name="requests" id="signup">
<input type="text" id="txtTitle" name="txtTitle" placeholder="Enter Your Description" required="" value="<?php if (isset($_POST['txtTitle'])) { echo $_POST['txtTitle'];}?>" <?php echo isset($_POST['txtTitle']) ? "readonly" : "" ?> >
<button type="submit" value='Submit' class="sendButton" name="submit" id='submitme'>Submit</button>
</form>
</div>
答案 1 :(得分:-1)
尝试一下:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<form method="POST" name="requests" id="signup">
<input type="hidden" value="yes" name="send">
<input type="text" id="txtTitle" name="txtTitle" placeholder="Enter Your Description" required="" value="<?php if (isset($_POST['txtTitle'])) { echo $_POST['txtTitle'];}?>" <?php echo isset($_POST['txtTitle']) ? "readonly" : "" ?> >
<button type="submit" value='Submit' class="sendButton" name="submit" id='submitme'>Submit</button>
</form>
</div>
<script type="application/javascript">
$(document).ready(function(){
<?
//
echo "var send='". $_POST['send']."';";
?>
if(send=="yes"){
$('#txtTitle').attr('disabled','disabled');
};
});
</script>