2

Haven't come up with much as far as documentation goes. How do I find an element with a particular class name that also has a specified attribute value.?

function go_to_page(page){
    $('.page_link[longdesc=page]').addClass('.active_page'); 
}

I got the example from here. Tried testing it myself and it didn't seem to work.

0

2 Answers 2

9
function go_to_page(page){

    $('.page_link[longdesc=' + page + ']').addClass('active_page'); 

}
Sign up to request clarification or add additional context in comments.

1 Comment

We all have our moments ;)
1

You have some errors in your syntax, try:

 function go_to_page(page){

     $('.page_link[longdesc='+page+']').addClass('active_page'); 
 }

classes normally don't start with a dot (only in the selector not the name)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.