I don't really see where your link is, but if you had .click(function
(e){e.preventDefault();} to your link, that should disable it.

On Jul 8, 3:54 pm, Jan Limpens <jan.limp...@gmail.com> wrote:
> hi there!
>
> this plugin extends an input text with 2 links that increase or decrease
> it's value by 1.
> unfortunately, due to my dumbness it is not working as I would expect.
>
> When one clicks at one of the links, the link works normally as a link would
> (making the request to "").
>
> Anybody could tell me what I am doing wrong - I am definitely suffering from
> jquery blindness here...
>
> (function($) {
>     jQuery.fn.spinner = function() {
>         var input = $(this);
>         var makeButton = function(cssClass, text) {
>             return $('<a href="" class="' + cssClass + '"><span>' + text +
> '</span></a>');
>         };
>         var spin = function(value) {
>             var val = parseInt(input.val());
>             var newValue = isNaN(val)
>                 ? 0
>                 : val;
>             if (newValue + value > -1) {
>                 newValue += value;
>             }
>             input.val(newValue);
>             return false;
>         };
>         input.wrap('<div class="spinner"/>');
>         var spinDown = makeButton('spinDown', '-');
>         input.before(spinDown);
>         spinDown.click(function() {
>             return spin(-1);
>         });
>         var spinUp = makeButton('spinUp', '+');
>         input.after(spinUp);
>         spinUp.click(function() {
>             return spin(1);
>         });
>     };
>
> })(jQuery);
>
> <input type="text" id="spinMe" name="xxx" value="0"/>
>
> $('#spinMe').spinner();
>
> --
> Jan

Reply via email to