Skip to main content

Bug Tracker

Side navigation

#7551 closed bug (invalid)

Opened November 18, 2010 11:41AM UTC

Closed November 18, 2010 12:19PM UTC

Multiple radio val bug

Reported by: anonymous Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:
Description

if i have this inside $(document).ready(function() {:

ex = $('#ex-show').css('display','none');
ri = $('#ri-show').css('display','none');
li = $('#li-show').css('display','none');
$('#show-ex').change(function() {
if ($("input[@name=expectation]:checked").val() == 'yes') {
	ex.show(500);
} else {
	ex.hide(500);
}
});

$('#show-ri').change(function() {
if ($("input[@name=rights]:checked").val() == 'no') {
	ri.show(500);
} else {
	ri.hide(500);
}
});
$('#show-li').change(function() {
if ($("input[@name=licence]:checked").val() == 'yes') {
	li.show(500);
} else {
	li.hide(500);
}
});

It will only show hide the first, the second one awlays tells me the value is 'no' and does not change of the radio

html:

<div class="radio" id="show-ex">
	<label>Yes<input type="radio" name="expectation" value="yes"/></label>
	<label>No<input type="radio" name="expectation" value="no"/></label>
</div>
<div id="ex-show">FOO</div>
<div class="radio" id="show-ri">
	<label>Yes<input type="radio" name="rights" value="yes"/></label>
	<label>No<input type="radio" name="rights" value="no"/></label>
</div>
<div id="ri-show">BLAH</div>

You get the idea.... missed off the third excuse any bits not working I cut and pasted these bits out.

I'm on firefox 3.6 thanks

Attachments (0)
Change History (1)

Changed November 18, 2010 12:19PM UTC by jitter comment:1

_comment0: → 1290083019315082
_comment1: There are several issues with the code you posted which are most likely causing the problems you are experiencing. \ \ - 1) js-code for elements not present (show-li etc) \ - 2) non quoted attribute selectors \ - 3) Usage of (since 1.3 deprecated) [@attr] style \ \ The jQuery bug tracker is not for support requests. Please use the [http://forum.jquery.com jQuery Forum] for support requests.1290180994563138
resolution: → invalid
status: newclosed

There are several issues with the code you posted which are most likely causing the problems you are experiencing.

  • 1) js-code for elements not present (show-li etc)
  • 2) non quoted attribute selectors
  • 3) Usage of (since 1.3 deprecated) [@attr] style

The jQuery bug tracker is not for support requests. Please use the jQuery Forum for support requests.

test case