我的页面中有一些表单,表单不是硬编码,
所有表格都有名称和唯一ID
但是在调用那些表格时,控制台没有定义
我想用jQuery提交表单,但是表单没有定义,
我尝试过:
alert(jQuery("#paypal_form_-5").length);
//output is 0
和
document.getElementById('paypal_form_-5').submit();
等。 但是不起作用.......
表单代码
<form target="_blank" action="https://www.paypal.com/cgi-bin/webscr" name="paypal_form_-5" id="paypal_form_-5" method="POST">
<input type="hidden" value="http://www.domain.com/2014/index.php?option=domain&view=addon_payments&type=return" name="return">
<input type="hidden" value="2" name="rm">
<input type="hidden" value="_xclick" name="cmd">
<input type="hidden" value="rajnvr@rctech.org" name="business">
<input type="hidden" value="USD" id="paypal_form_currency_code_-5" name="currency_code">
<input type="hidden" value="http://www.domain.com/2014/index.php?option=domain&view=addon_payments&type=cancel" name="cancel_return">
<input type="hidden" value="http://www.domain.com/2014/components/domain/views/addon_payments/paypal_ipn.php" name="notify_url">
<input type="hidden" value="GOLD Membership" name="item_name">
<input type="hidden" value="20" id="paypal_form_amount_-5" name="amount">
<input type="hidden" value="http://www.domain.com/2014/components/domain/views/addon_payments/paypal_ipn.php" name="notify_url">
<input type="hidden" value="001" name="item_number">
<input type="hidden" value="2740" name="custom">
<span id="paypal_price_title_-5" class="paypal_price_title">GOLD Membership 20 USD</span>
<input type="button" onclick="send_request_to_paypal_express(-5);" value="Pay" name="button_-5">
</form>
答案 0 :(得分:0)