-
-
Save anonymous/833b7bf71869f5cf827c to your computer and use it in GitHub Desktop.
はてな質問用
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$('label img').toggle( | |
function () { | |
var onSrc = $(this).attr('src').replace('.png', 'kakikae.png'); | |
$(this).attr('src', onSrc); | |
}, | |
function () { | |
var onSrc = $(this).attr('src').replace('kakikae.png', '.png'); | |
$(this).attr('src', onSrc); | |
} | |
); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<input type='checkbox' name='ck2' id='a1' > | |
<label for='radio1' > | |
<img src='http://test.png'/> | |
</label> | |
<input type='checkbox' name='ck2' id='a1' > | |
<label for='radio2' > | |
<img src='http://test.png'/> | |
</label> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$('label').toggle( | |
function () { | |
$(this) | |
.addClass('checked') | |
.prev('input').attr('checked','checked'); | |
}, | |
function () { | |
$(this) | |
.removeClass('checked') | |
.prev('input').removeAttr('checked'); | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment