138 posts
  • Sells items exclusively on Envato Market
  • Has sold $1,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
  • Contributed a tutorial on Tuts+
+5 more
ram64 says

I’m trying to get a start here on Codecanyon and I want to know if there are any coding guidelines that I should follow for JavaScript files (or any other file). I’m especially curious if I should follow a specific commenting convention for classes?

Thank you,

Alex

320 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Had an item featured in an Envato Bundle
  • Has collected 1+ items on Envato Market
+2 more
jwmcpeak says

Just follow good, industry standard practices and you’ll be fine. Comments are secondary and usually not a factor if an item is accepted or rejected.

138 posts
  • Sells items exclusively on Envato Market
  • Has sold $1,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
  • Contributed a tutorial on Tuts+
+5 more
ram64 says

Just follow good, industry standard practices and you’ll be fine. Comments are secondary and usually not a factor if an item is accepted or rejected.

Thanks for the info. Cheers

56 posts
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Located in United Kingdom
+4 more
JMDDesigns says

As you probably already know some of this, it might not help; but it’s the same principle for anything code-based written.

Simple School Boy Guidelines:
1.Keep your code clean and cluster free. 2. Use shorthand code instead of writing everything our separately; use wherever possible.
For example:

$(function(){    
    $('#div').on('click', function() {
        $('#div').css('background-image', 'url(img/folder/file.png)');
            $('.div2').css('color', '#fff');
                        $('.div3').css('color', '#fff');
                        $('.div4').css('color', '#fff');
    })
});


Would become:
$(function(){    
    $('#div').on('click', function() {
        $('#div').css('background-image', 'url(img/folder/file.png)');
            $('.div2, .div3, .div4').css('color', '#fff');
    })
});

I could go on and on and on, about using (this) and (that) forever, but here is a great practice site here:
http://www.jameswiseman.com/blog/2010/04/20/jquery-standards-and-best-practice/
It’s got practically everything you need.
138 posts
  • Sells items exclusively on Envato Market
  • Has sold $1,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
  • Contributed a tutorial on Tuts+
+5 more
ram64 says

As you probably already know some of this, it might not help; but it’s the same principle for anything code-based written
.... I could go on and on and on, about using (this) and (that) forever, but here is a great practice site here:
http://www.jameswiseman.com/blog/2010/04/20/jquery-standards-and-best-practice/
It’s got practically everything you need.

Every infromation is usefull. Although there are tons of resources out thereI thought maybe here on codecanyon there are some specific guidelines/rules to follow.

Thanks for your reply.

106 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Located in Australia
  • Has sold $1,000+ on Envato Market
+2 more
pjtops says

For Javascript, jslint (http://www.jslint.com/) can help a lot in keeping your code consistent, and even catching some bugs along the way.

138 posts
  • Sells items exclusively on Envato Market
  • Has sold $1,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
  • Contributed a tutorial on Tuts+
+5 more
ram64 says

For Javascript, jslint (http://www.jslint.com/) can help a lot in keeping your code consistent, and even catching some bugs along the way.

Great. Thanks for sharing! :)

5357 posts The Dude Abides
  • Located in United States
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
+9 more
CodingJack says

I prefer http://www.jshint.com/

I also hate using anonymous functions and coming from AS3 you probably will too :D

Good luck :)

138 posts
  • Sells items exclusively on Envato Market
  • Has sold $1,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
  • Contributed a tutorial on Tuts+
+5 more
ram64 says

I prefer http://www.jshint.com/

I also hate using anonymous functions and coming from AS3 you probably will too :D

Good luck :)

Yup… It’s a pain. But what can you do? Need to move on with industry standards (?).

Also, thank you!

24 posts
  • Has referred 200+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+5 more
OnePress says


Would become:
$(function(){    
    $('#div').on('click', function() {
        $('#div').css('background-image', 'url(img/folder/file.png)');
            $('.div2, .div3, .div4').css('color', '#fff');
    })
});

Do you really use the jquery css method to set a background image and to change colors?

by
by
by
by
by
by