jQuery click嵌套click点击两次才执行
<scripttype="text/javascript">varpath='<%=path%>';vartarName='<%=tarName%>';varlmsx='...
<script type="text/javascript">
var path='<%=path%>';
var tarName='<%=tarName%>';
var lmsx='';
$(document).click(function(){
$('[name="nice-select"] ul').hide();
$('[name="nice-select"]').click(function(e){
$('[name="nice-select"]').find('ul').hide();
$(this).find('ul').show();
e.stopPropagation();
});
$('[name="nice-select"] li').hover(function(e){
$(this).toggleClass('on');
e.stopPropagation();
});
$('[name="nice-select"] li').click(function(e){
var val = $(this).text();
var dataVal = $(this).attr("data-value");
$(this).parents('[name="nice-select"]').find('.hrb').val(val);
$('[name="nice-select"] ul').hide();
e.stopPropagation();
//alert($(this).parents('[name="nice-select"]').find('input').val());
});
});
</script>
如何点击一次就执行呢?请教 展开
var path='<%=path%>';
var tarName='<%=tarName%>';
var lmsx='';
$(document).click(function(){
$('[name="nice-select"] ul').hide();
$('[name="nice-select"]').click(function(e){
$('[name="nice-select"]').find('ul').hide();
$(this).find('ul').show();
e.stopPropagation();
});
$('[name="nice-select"] li').hover(function(e){
$(this).toggleClass('on');
e.stopPropagation();
});
$('[name="nice-select"] li').click(function(e){
var val = $(this).text();
var dataVal = $(this).attr("data-value");
$(this).parents('[name="nice-select"]').find('.hrb').val(val);
$('[name="nice-select"] ul').hide();
e.stopPropagation();
//alert($(this).parents('[name="nice-select"]').find('input').val());
});
});
</script>
如何点击一次就执行呢?请教 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询