I am sort of new to JavaScript and something has been bugging me.
Say I have some code like this:
$('button').on('click', function() {
var id = $(this).attr("id") // id being a file name sans extension
$('.content').load(id + '.php');
});
Everything works just fine, but something in the back of my head tells me that this is bad practice. Any thoughts?
It’s fine but you can save some operations using this.id
I like this article here: https://stackoverflow.com/tags/jquery/info