Title: function name javascript in plugin
Last modified: October 3, 2018

---

# function name javascript in plugin

 *  [thomas1gawehns](https://wordpress.org/support/users/thomas1gawehns/)
 * (@thomas1gawehns)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/function-name-javascript-in-plugin/)
 * Hi there,
    I plan to create a plugin to display a subscribe/unsubscribe button
   in a widget. It comes with to javascript function: subscribe() and unsubscribe().
   There is no framework used, but is there a name convention to avoid name clashes????
 * rgds. Thomas

Viewing 1 replies (of 1 total)

 *  [Khalid](https://wordpress.org/support/users/mdotkhalid/)
 * (@mdotkhalid)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/function-name-javascript-in-plugin/#post-10739253)
 * There is no hard rule for following a naming convention but you can do it in 
   two ways:-
    1. Using a prefix – such as `pluginname_subscribe()` or `pluginname_unsubscribe()`
    2. Using a JSON object to wrap the functions such as:
    3.     ```
           var pluginobj = {}; 
           pluginobj.subscribe = function(){
           // Code Here
           }
           pluginobj.unsubscribe = function(){
           // Code Here
           }
           ```
       
 *  -  This reply was modified 7 years, 10 months ago by [Khalid](https://wordpress.org/support/users/mdotkhalid/).

Viewing 1 replies (of 1 total)

The topic ‘function name javascript in plugin’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Khalid](https://wordpress.org/support/users/mdotkhalid/)
 * Last activity: [7 years, 10 months ago](https://wordpress.org/support/topic/function-name-javascript-in-plugin/#post-10739253)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
