Jquery increment numbers with a limit of 5
<p>I'm adding text fields with a onclick. What I'm trying to do is limit the amount of boxes to about 5.</p>

<p>I also need to increment the number to use as an ID.</p>

<p>my code: </p>

<pre><code>jQuery('#add_slider_image').click(function() {

        var i = 0
        var plus = ++i;


        jQuery('.form-table').append("&lt;tr&gt;&lt;td&gt;&lt;input type'text' value='' name='slider[]' /&gt;&lt;input type='button' name='sliderbut' value='Upload' id='button' rel='"+ plus +"' /&gt;&lt;/td&gt;&lt;tr&gt;");

        var count = jQuery.('#button').attr('rel');

        if(count=5){
         alert('Limit reached');
        }
    })
</code></pre>

<p>THanks</p>
