jquery plugin syntax 
I am trying to create a jquery plugin 

I want have the following options:

1- $.plugin_name(variable)

2 - $(selector).plugin_name(variable)

the first case the plugin would not need to be applied to an element ( it could create one for example) the second case the same plugin will do whatever it does on the element/s selected

my question how do i specify inside the plugin this

if (selector is not given)   {create an element } else {( for example) insert variable in elements matching the selector}

thank you for your help
jquery plugin syntax 
===

I am trying to create a jquery plugin 

I want have the following options:

1- $.plugin_name(variable)

2 - $(selector).plugin_name(variable)

the first case the plugin would not need to be applied to an element ( it could create one for example) the second case the same plugin will do whatever it does on the element/s selected

my question how do i specify inside the plugin this

if (selector is not given)   {create an element } else {( for example) insert variable in elements matching the selector}

thank you for your help