How to write $('label.someClass').attr('valid', true); in Java Script with out using jQuery?
How to write $(‘label.someClass’).attr(‘valid’, true); in Java Script with out using jQuery?
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.
Find all the
labelelements usinggetElementsByTagNamewhich gives an array of matching elements. Run a loop on this array and check if the class name exists and set the attribute usingsetAttributemethod.If the browser supports
getElementsByClassNamethen we can use that conditionally.