我的問題很難解釋,所以我做了一個jsfiddle
。問題在於。當我第一次點擊<li>
時,我收到1條警告消息。點擊裏面點擊功能導致警告消息顯示不止一次 - jquery/Javascript
現在我再次點擊任何<li>
,現在我得到2警報。
任何input field --> then li --> then input field again --> then li again.
標記首先點擊:
<input type='text' class='InputField'>
<input type='text' class='InputField2'>
<input type='text' class='InputField3'>
<div class="ranges FullBoxControl" style='display:none'>
<ul>
<li>This Month</li>
<li>This Year</li>
<li>Last 5 Years</li>
<li>Last 10 Years</li>
<li>Custom Range</li>
</ul>
</div>
Script代碼:
$(".InputField").click(function()
{
$('.FullBoxControl').show();
$('.FullBoxControl').click(function()
{
alert('Greetings');
});
});
$(".InputField2").click(function()
{
$('.FullBoxControl').show();
$('.FullBoxControl').click(function()
{
alert('Greetings');
});
});
$(".InputField3").click(function()
{
$('.FullBoxControl').show();
$('.FullBoxControl').click(function()
{
alert('Greetings');
});
});
問我你是否有人不明白。
即將發佈相同的東西。這可能是你最好的選擇 –
@DylanCorriveau歡呼! – Dave