javascript - Value becomes empty when selecting button -


my html code :

<div class="span3">             <div>debit/credit</div>             <div class="btn-group" data-toggle="buttons-radio" id="investadjust-debitcredit-button">                 <button name="debitcredit" type="button" id="credit-button" class="btn active" value="credit" >credit</button>                 <button name="debitcredit" type="button" id="debi-button" class="btn" value="debit" >debit</button>             </div>         </div> 

javascript code data:

 $("#investadjust-debitcredit-button>.active").val() 

when load page values empty value because of unable value of selected button.

how resolve this.

first of all, dont think switching between button or input elements help. jquery entirely independent of that

well, have not mentioned javascript, can use following code selected button value: -

$(".active", $(".btn-group")).val() 

try alerting above sentence , ll wat u r looking


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -