我有一个要求提供信用卡信息的可折叠表格。当有人单击提交时,我希望将卡号移动到另一个列表。我如何使用 Javascript 来做到这一点。这是我的html:
<div class= "addStuff">
<div data-role="collapsible" data-inset="true" >
<h5> New credit card</h5>
<div data-role="fieldcontain">
<input type="password" name="credit_card_number" id="credit_card_number" value="" placeholder="Credit Card Number">
<input type="password" name="security_code" id="security_code" value="" placeholder="Security Code">
<input type="date" name="expiration_date" id="expiration_date" value="" placeholder="Expiration Date">
<input type="password" name="name" id="name" value="" placeholder="Name On Card">
<input type="password" name="street_address" id="street_address" value="" placeholder="Street Address">
<input type="text" name="city" id="city" value="" placeholder="City">
<input type="number" name="zip_code" id="zip_code" value="" placeholder="Zip Code">
<form action="accounts.html" method="post">
<button type="submit" class="submit" name="submit" value="submit" data-theme="">Submit</button>
</form>
</div>
</div>
</div>
这是我要添加到的列表:
<div class="accounts">
<h2>Existing Acounts </h2>
<ul data-role="listview" >
<div id= "Credit Cards">
<li><a href="AccountDetails.html">BofA Enhcanced Checking 3212</a></li>
<li><a href="AccountDetails.html">BankAmericard Platinum Plus Visa 4567</a></li>
<li><a href="AccountDetails.html">CITI Platinum 4331</a></li>
</div>
</ul>
<ul data-role="listview" >
<div id= "Accounts">
<li><a href="AccountDetails.html">Bank of America Checking</a></li>
<li><a href="AccountDetails.html">Bank of America Savings</a></li>
</div>
</ul>
这是我的尝试:
$('document').ready(function() {
$('.addStuff .submit').click(function(){
$('#credit_card_number').addClass('.accounts' )
});
});