//html页面
<p class="fix">
<label class="word word2"></label>
<label class="sex current" data-value="1" οnclick="current($(this))">男</label>
<label class="sex" data-value="2" οnclick="current($(this))">女</label>
<input type="hidden" name="sex" id="sex" value="1"/>
</p>
<pre name="code" class="html"> function current(obj){
var a=obj.data('value');
obj.addClass('current').siblings().removeClass('current');
console.log(obj.siblings('input').val());
obj.siblings('input').val(a);
}