166
rated 0 times
[
168]
[
2]
/ answers: 1 / hits: 33812
/ 10 Years ago, mon, july 21, 2014, 12:00:00
I want the customer to be able to either buy phone line or credit.
At first, both div
s are hidden, and I want the related div
to unhide (or show
) when the customer chooses one purchase option.
Here is my code, but nothing happens when I check one of the two radio buttons.
I don't want the page to postback, so I cannot set AutoPostBack=true
Any help on what I am doing wrong is really appreciated =)
<script language=javascript type=text/javascript>
$(document).ready(function () {
$(#radLinePanel).click(chkPanelChanged);
$(#radCreditPanel).click(chkPanelChanged);
chkPanelChanged();
});
function chkPanelChanged() {
if ($(#radLinePanel).is(':checked')) {
$(#divLine).show(medium);
}
else {
$(#divLine).hide(medium);
}
if ($(#radCreditPanel).is(':checked')) {
$(#divCredit).show(medium);
}
else {
$(#divCredit).hide(medium);
}
}
</script>
<div class=GreenPanel>
<div class=GreenPanelHeader>
<asp:RadioButton ID=radLinePanel runat=server GroupName=ItemToBuy Checked=false Text= ClientIDMode=Static/>
Buy New Phone Line
</div>
<div id=divLine class=GreenPanelContent runat=server>
Blablabla
</div>
<div class=GreenPanelHeader>
<asp:RadioButton ID=radCreditPanel runat=server GroupName=ItemToBuy Checked=false Text= AutoPostBack=false/>
Buy credit
</div>
<div id=divCredit class=GreenPanelContent runat=server>
Blablabla
</div>
</div>
More From » jquery