-1
私は新しい開発者です。私は2つの変数 "packageprice"と "eventprice"の間で計算したい。どのような2つの変数jqueryで計算します
<div id="result">
で、この2つの変数と結果ショーでほかに:packageprice + eventprice =値がその中に保存されていることを意味するブロック内のすべての宣言あなたの変数の
jQuery(document).on('click', '#asdasd option', function(){
jQuery('#ssss').val(jQuery(this).val());
var packageprice = jQuery("#rrrr").text(jQuery(this).attr('id'));
});
jQuery(document).on('click', '#event option', function(){
jQuery('#ssss').val(jQuery(this).val());
var eventprice = jQuery("#eventprice").text(jQuery(this).attr('id'));
});
1を、あなたのHTML構造も示してください。 。 2、いつ計算をしたいのですか?各ボタンをクリックするか、上記のバインディングに対して別のボタンをクリックしますか? 3. ssssとrrrrは何ですか? 4 idが価格で、オプションにidがない場合、このコードは機能しません。良い質問をするにはヘルプセンターをご覧ください – Pete
「
[mcve]のサンプルHTMLを提供します。 – charlietfl