Mobile app version of vmapp.org
Login or Join
Fox8124981

: As per W3C can we add onclick inside li tag? I have 2 questions: As W3C can we add onclick inside <li> tag? Will this affect anything to do with SEO? For example: <li onclick="newDoc()">Click!</li>

@Fox8124981

Posted in: #Html #Seo #W3cValidation

I have 2 questions:


As W3C can we add onclick inside <li> tag?
Will this affect anything to do with SEO?


For example:

<li onclick="newDoc()">Click!</li>

function newDoc() {location.assign("http://validator.w3.org/");}

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8124981

1 Comments

Sorted by latest first Latest Oldest Best

 

@Deb1703797

As far as I know, inline JavaScript is a no no. You seperate your HTML, PHP, CSS and JS files into different files. Inline styling/coding only makes bad maintainable code. You'll forget where you did what, and debugging will become a pain in the ass.

For SEO, if your pages are HTML(x/5) valid, no problems. As long as you don't expect them to run JavaScript (e.g.: show content only after click).

Yes, there are some situations where inline style/coding is OK, but they're exceptions.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme