What are some tips and tricks every Front end developer should learn with HTML,CSS, and JavaScript or PHP?

HTML:
If you want to store some information about some data of an element and you don’t want to store it in a variable then you can create an attribute inside the tag of that element and store that information there.

Like,

<input type=’text’ employee_type=’tier1′ id=’employee_name’ val=’Person 1′ />


or

Person 1

CSS:
display:inline is sometimes better than setting float

Javascript:
If you are loading same html content over ajax multiple times and if it has some javascript/jQuery methods called using class or id selectors then better change those methods to functions and call them using inline event handlers from elements.

Like,
instead of

$(‘#selector’).on(‘click’,function(){//do something});

use

<script>function clickSelector(){//do something};

Reason being, every time html content you load dynamically in your DOM, javascript will treat every method as separate object and it will stack them one over the other, so the same method will be called multiple times even when you click on the selector element just once.

 

 

Duda

About the Author

About Thomas

Thomas Duda is a web designer who lives in Bakersfield, CA with his wife and dogs. He is also interested in: Blogging, Writing, Vaping, Fishing, Swimming and Drawing.

Leave a Reply