Variable function in jquery
<p>i am not really good in jquery.
Is it possible, to put a variable operator to make a function work? Because of different versions of jQuery used on different Pages. </p>

<p>The <strong>.on</strong>-function came up in 1.7 but some sites are running with lower version and therefore i need to use the <strong>.click</strong> function instead. And i want to avoid duplicate code for each version.</p>

<p>For example :</p>

<pre><code>$('#mySelector')(var &lt;= 3.4) ? ".click(function()" : ".on('click', function()");

{
    $( "#dialog p span" ).remove(); 
    $( "#dialog p" ).append('&lt;span&gt;'+ isEncHTML(html_output) 
});
</code></pre>

<p>Thank you all for your help.</p>

<p>To make it more clear:</p>

<p>This works with 1.7 (includes the buttons - option:</p>

<pre><code>$('.delete_league, .print_league').on('click', function() 
{
        $( "#dialog p" ).append('&lt;span&gt;'+wpslm_v_script_vars.delete_league+'&lt;/span&gt;');
            $( "#dialog" ).dialog({ 
                modal: true, 
                buttons: 
                [{
                    text: "OK",
                    click: function() 
                    { 
                        $( "#dialog p span" ).remove();
                        $(this).dialog("close"); 
                    }
                }] 
            });
});
</code></pre>

<p>And this work with 1.6. If i keep the buttons-option, it throws an error.</p>

<pre><code>    $('.delete_league, .print_league').click(function() 
{
    // Just in case there is an old message hanging around
    $( "#dialog p span" ).remove(); 
    $( "#dialog p" ).append('&lt;span&gt;'+ isEncHTML(wpslm_v_script_vars.delete_league) +'&lt;/span&gt;');
    $( "#dialog" ).dialog({ 
        modal: true
    });
});
</code></pre>

<p>So, i want to make the selector-line(and the buttons-option) variable so that i can use the same code for both. Means, if i see that i am running an older version than 1.7 i ust eht .click without buttons otherwise i use .on with the buttons-option.
I hope that is not too confusing now.</p>
