I have a HTML unsorted list which I capture its “on click” event. When a list item is clicked on I want to change that items font setting to bold so that the user gets a visual indicator that it’s been selected. Is this possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
<li onclick="this.style.fontWeight= 'bold'">Or do you want to change it back to regular when another li is clicked? I think you should use jQuery then (it’s possible in regular javascript but this is just so much easier)
Or even easier, just add a class:
CSS:
.selected { font-weight: bold }jQuery: