Click here to Skip to main content
15,914,447 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii ,

<script type="text/javascript">
$(document).ready(function () {
debugger;
$('#Draft').live('click', function () {
alert("I am Draft Here");
});

$('#Live').live('click', function () {
alert("I am live Here");
});

$('#Completed').live('click', function () {
alert("I am completed Here");
});
});
</script>

Curretly i am checking all id and binding click function for each ..

is there any way in which i can fetch all span elements .. say whose style attribute is like
Quote:
style="color:

<span style="color:#F3660E;" id="Draft">Draft: (2138)</span>


and based on that i can get all span elemnts related to that and then i can check each id and execute my respective code on click
Posted

1 solution

You can do something like-
JavaScript
$('span').filter(function() {
    return $(this).css('color') == 'red';
}).live('click', function () {
alert("I am here !");
});


Hope, it helps :)
 
Share this answer
 
Comments
Torakami 17-Apr-15 7:43am    
Thanks for your help , i am completely new on jquery . Your help was most helpful for me
Suvendu Shekhar Giri 17-Apr-15 7:47am    
Glad that it helped. Please mark as answer if it resolved your issue so that others can take reference :)

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