I have a span Text goes her like this
$(\'#contentarea\').bind(\'click\',function(e){
First of all a heads up, the :contains() selector is for the content of the DOM node, so you could use it with the following HTML:
Hello World // will alert when clicked
Goodbye World // will not alert when clicked
And the following jQuery:
$('#contentarea').bind('click',function(e){
e.preventDefault();
if($(e.target).is('span')){
if($(e.target).is(':contains(Hello)')){
alert($(e.target).text());
}
}
});
What you're trying to do is look at the applied CSS styles, or an attribute, so you would want to do something more like this:
HTML:
Hello World
Hello World
Hello World
jQuery:
$('#contentarea').bind('click',function(e){
e.preventDefault();
if($(e.target).is('span')){
if($(e.target).css('font-weight')==="bold" || $(e.target).css('font-weight')==="700"){
alert($(e.target).text());
}
}
});