Blogger Ever

5 Jquery mistakes a web-designer can do

5 Jquery mistakes a web-designer can do

Write less do more ,but without mistakes.I've observed and collected some of the mistakes that I've seen while coding,by either me or by any other.Therefore,I'm going share those points to reduce the mistakes as much as you can.So lets begin,

1.Execute when DOM is ready
This is the most common mistake while writing Jquery.If you want to do a Jquery function then,add the code when the DOM is ready.As given below,
//Function to be executed
//Function to be executed});
2.Add script tagsIf you are adding a Javascript function in a HTML page then you must insert it in a script tag,like I've done below.
//Function to be executed</script>
3.While selecting event handler $(this)

This is a minor mistake,that results in failure of the script.We must know that while selecting a variable or the event trigger,we do not use quotation (').It means that $('this') is wrong and $(this) is correct.

4..text() is not .html()

.text() is the function we use to get the text,it means only text.While .html() we use to get the whole data including links and images and .text() will not return the links.

5..val() is used in input,not .text()

To take the input value,.text() method do not work,but .val() is used to get the input value.

2013-2016 Copyright Blogger E\ver . Coded, managed and founded by Mohammad Hamza (@hamzadhamiya) . Hosted on Blogger and fonts used are Raleway and Open Sans.