Hi I am using following code for applying multiple attributes of css through jquery. My code is
$("div:contains('Awais')").css( {text-decoration : 'underline', cursor : 'pointer'} );
I get javascript error
missing : after property id
$("div:contains(John)").css( {text-dec...: 'underline', cursor : 'pointer'} );
But When I remoce text-decoration
property the error vanishes. What is wrong with this code
text-decoration
is an invalid property name unless it's enclosed in quotes as a string:
$("div:contains('Awais')").css( {'text-decoration' : 'underline', cursor : 'pointer'} );
Object properties must be enclosed in quotes unless they are valid Javascript identifiers. This is true for declarations in object literals and also for accessing using the dot notation (so object.text-decoration
is invalid.