Click here to Skip to main content
15,923,168 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is the code
HTML
<li style="display:inline-block;">
                <ul class="cal-filter">
                    <li><a id="1W">1W</a></li>
                    <li><a id="1M">1M</a> </li>
                    <li><a id="3M">3M</a></li>
                    <li><a id="6M">6M</a></li>
                    <li><a id="1Y">1Y</a></li>
                    <li><a id="MTD">MTD</a></li>
                    <li><a id="YTD">YTD</a></li>
                </ul>
            </li>


What I have tried:

i just want to disable the li item based on the result of comparing two dates i.e., if difference between two dates is > 7, i must disable 1W.if > 30, i must disable 1M and soon...

$(".cal-filter li 1W").hide() is completely removing 1W. but I just want to disable it like some buttons we disable.
Posted
Updated 27-Jun-16 2:44am
v2

use disabled attribute instead of hide()

JavaScript
$(".cal-filter li #1W").attr("disabled","disabled");

since you know the Id you shall use selector directly.
JavaScript
$("#1W").attr('disabled','disabled')


moreover this will disable the Anchor Tag inside the li element. you should provide more information to give a precise answer.
 
Share this answer
 
v2
Just by disabling the li will not work.
you will need to remove href attribute along with disabling the li

$("#1W").attr("disabled","disabled");
$("#1W").removeAttr('href');
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900