請問我可以獲取添加/刪除動態文本框的框架,然後發佈附加結果。動態添加/刪除文本框併發布到php
我想它看起來就像這樣:
[清空文本框] [添加按鈕]
一旦值1放入文本框,並添加點擊它會顯示:
[清空文本框] [添加按鈕]
[值1] [刪除按鈕]
一旦添加了所有內容,我希望它被髮布並允許用戶刪除任何添加的文本框。
我一直在尋找例子,並找不到一個這樣的作品。
<form method="post" id="multi" action="process.php">
<label for="cname">Company Name: <span class="required">*</span></label>
<input type="text" size="30px" id="cname" name="cname" value="<?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['cname'] : '' ?>" placeholder="The Rainbow Kingdom" required autofocus />
<label for="name">Contact Name: <span class="required">*</span></label>
<input type="text" size="30px"id="name" name="name" value="<?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['name'] : '' ?>" placeholder="John Doe" required autofocus />
<label for="email">Email Address: <span class="required">*</span></label>
<input type="email" size="50px" id="email" name="email" value="<?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['email'] : '' ?>" placeholder="[email protected]" required />
<label for="telephone">Telephone: </label>
<input size="9px" placeholder="1112223333" autofocus maxlength="9" type="tel" id="telephone" name="telephone" value="<?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['telephone'] : '' ?>" />
<div>
<label>Tag</label><input class="tag" type="text" name="" type="text" />
<div id="content" ></div>
</div>
<label for="message">Message: <span class="required">*</span></label>
<textarea id="message" name="message" placeholder="Your message must be greater than 20 characters" required data-minlength="20"><?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['message'] : '' ?></textarea>
<p id="req-field-desc">
<span class="required">*</span> indicates a required field
</p>
<span id="loading"></span>
<input type="submit" value="Submit!" id="submit-button" />
</form>
嗨,是否有可能把按鈕代碼的形式?我這樣做似乎不起作用。只是放置。目前我的表單有更多的字段,我希望它被放置在表單的中間。 – Den
http://jsfiddle.net/MJUzM/2/如果你把按鈕放在你的表格中。您必須使用或在點擊處理程序中返回false。 –
你是不是像這樣的東西? \t \t \t \t