Problem with ASP.Net-CheckBox-Control and CSS-Class
Hello, I observed the following problem. I use ASP.NET and jQuery. When clicking on the checkboxes, the div has to change color. But this only works correcty with the input control. When clicking on the .Net-control, the color only changes to blue, so it does not recognize the true state of the control (active, inactive). The problem only(?) appears when using the css-class-property.
<script src="Scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".aspCb").click(function() {
if (this.checked) {
$('.example').css('background', '#ffff00');
}
else {
$('.example').css('background', '#0000ff');
}
});
$(".cb").click(function() {
if (this.checked) {
$('.example').css('background', '#ffff00');
}
else {
$('.example').css('background', '#0000ff');
}
});
});
</script>
<asp:CheckBox ID="aspCb" CssClass="aspCb" runat="server" />
<input type="checkbox" id="cb" class="cb" />
<div class="example" style="width:100px; height:100px">text
</div>
Change History (2)
Component: |
unfiled →
css
|
Owner: |
set to anonymous
|
Priority: |
undecided →
low
|
Status: |
new →
pending
|
Resolution: |
→ invalid
|
Status: |
pending →
closed
|
Thanks for taking the time to contribute to the jQuery project!
If an issue is only experienced when using ASP.NET and the issue is not reproducible with jQuery alone, this is probably not a jQuery issue. However, if it can be reproduced, please provide a reduced test case on http://jsfiddle.net that reproduces the issue experienced to help us assess your ticket.
Additionally, test against the jQuery (edge)(or jQuery git) version to ensure the issue still exists.