javascript - Naming conventions - HTML elements in JS -


how name html element objects in js?

var diveditorarea = document.getelementbyid("editorarea");

var btnchecksyntax = document.getelementbyid("checksyntax");

is way?

to knowledge, there no convention naming html elements in js. javascript such diverse world if there convention, hardly followed majority of community. see, example, variety of code linters , code style conventions there (https://www.sitepoint.com/comparison-javascript-linting-tools/).

names should show intentions clearly, code understandable. don't think adding type of html element js variable names of use clarity purposes (the 'btn' , 'div' in example), there cases adds clarity. and, if in team, should follow team's conventions.

use best judgement , strive clarity in code.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -