javascript - jQuery and Livequery Help for onchange() -



javascript - jQuery and Livequery Help for onchange() -

i new js , jquery , trying show selected value select filed in 2 different place, did using javascript function. using #id. need utilize class name instead of #id. found jquery live easy solution. please help me anybody. here jsfiddle link.

here utilize 2 select options 1 select , view selected comment, select , display quantity. comment alternative okay in js using #id. tried same result in quantity alternative jquery livequery , taking help class.

plaese help , in advance.

http://jsfiddle.net/kb3gn/7013/

i need help part:

######################### function selectqty(){ $(".qtyclass").change(function(){ var quantity= $(this[this.selectedindex]).val(); $('.pakquantity1').html(quantity); $('.pakquantity2').html(quantity); }); } ##########################

class="snippet-code-js lang-js prettyprint-override">function getoption(){ var obj = document.getelementbyid("commentlist"); document.getelementbyid('display2').innerhtml = obj.options[obj.selectedindex].text ; document.getelementbyid('display1').innerhtml = obj.options[obj.selectedindex].value ; } function selectqty(){ $(".qtyclass").change(function(){ var quantity= $(this[this.selectedindex]).val(); $('.pakquantity1').html(quantity); $('.pakquantity2').html(quantity); }); } class="snippet-code-html lang-html prettyprint-override"><script src="http://github.com/brandonaaron/livequery/raw/master/jquery.livequery.js" type="text/javascript"></script> <form method="post" class="form-horizontal" name="form"> <div class="col-sm-6"> <label>add comment: </label> <select id="commentlist" name="sale_comments" onchange="getoption()"> <option selected="">choose comment</option> <option value="1">extra spicy</option> <option value="2">extra sugar</option> <option value="3">alabama</option> </select> </div> <div class="col-sm-6"> <label>add quantity: </label> <select id="qtydropdown" class="qtyclass" name="quantity" onchange="selectqty()"> <option selected="" >quantity</option> <option value="1" style="line-height:30px;">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </div> </form> <div style=" padding:10px; border-radius:5px; border: 1px solid #666; " > <!------ lines show info in modal box before submit----> <h4><span ><strong>package: </strong></span><span style="" class="name">samsang 4gs </span></h4> <h4><span ><strong>price: </strong></span><span class="price" style="" >1000</span> <h4><span ><strong>vat: </strong></span><span class="tax" style="" >15%</span> </h4> <h4><span ><strong>quantity: </strong></span> <span class="pakquantity1" id="displayqty2" style="" >1</span></h4> <h4><span ><strong>comment: </strong></span><span class="comment" name="comment" id="display2" style="" >no comments</span> </h4> </div> <div> <span style="display:none;" class="name">samsang 4gs </span> <br /> name:<span class="price" style="display:;" >1000</span> <br /> vat:<span class="tax" style="display:;" >15</span> <br /> quantity:<span class="pakquantity2" id="displayqty1" style="display:;" >1</span> <br /> commment no:<span class="comment " name="display1" id="display1" style="display:;" ></span> </div>

here used -->> http://code.jquery.com/jquery-latest.min.js

class="snippet-code-js lang-js prettyprint-override"> function getoption(){ var obj = document.getelementbyid("commentlist"); document.getelementbyid('display2').innerhtml = obj.options[obj.selectedindex].text ; document.getelementbyid('display1').innerhtml = obj.options[obj.selectedindex].value ; } function selectqty(){ $(".qtyclass").change(function(){ var quantity= $(this[this.selectedindex]).val(); $('.pakquantity1').html(quantity); $('.pakquantity2').html(quantity); }); } class="snippet-code-html lang-html prettyprint-override"><script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> <form method="post" class="form-horizontal" name="form"> <div class="col-sm-6"> <label>add comment: </label> <select id="commentlist" name="sale_comments" onchange="getoption()"> <option selected="">choose comment</option> <option value="1">extra spicy</option> <option value="2">extra sugar</option> <option value="3">alabama</option> </select> </div> <div class="col-sm-6"> <label>add quantity: </label> <select id="qtydropdown" class="qtyclass" name="quantity" onchange="selectqty()"> <option selected="" >quantity</option> <option value="1" style="line-height:30px;">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </div> </form> <div style=" padding:10px; border-radius:5px; border: 1px solid #666; " > <!------ lines show info in modal box before submit----> <h4><span ><strong>package: </strong></span><span style="" class="name">samsang 4gs </span></h4> <h4><span ><strong>price: </strong></span><span class="price" style="" >1000</span> <h4><span ><strong>vat: </strong></span><span class="tax" style="" >15%</span> </h4> <h4><span ><strong>quantity: </strong></span> <span class="pakquantity1" id="displayqty2" style="" >1</span></h4> <h4><span ><strong>comment: </strong></span><span class="comment" name="comment" id="display2" style="" >no comments</span> </h4> </div> <div> <span style="display:none;" class="name">samsang 4gs </span> <br /> name:<span class="price" style="display:;" >1000</span> <br /> vat:<span class="tax" style="display:;" >15</span> <br /> quantity:<span class="pakquantity2" id="displayqty1" style="display:;" >1</span> <br /> commment no:<span class="comment " name="display1" id="display1" style="display:;" ></span> </div>

javascript jquery html

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -