This has come up a number of times.

My suggestion is to use a "proxy link". When the link is pressed it
"clicks" the button.

Something like this:

$(function() {
       $('input.proxy').each( function() {
               var input = $(this);
               $('<a href="#">' + this.value + '</a>')
                       .attr( 'class', this.className )
                       .insertBefore( this)
                       .click( function() {
                               input.click();
                               return false;
                       });
               input.hide();
       });
});

(Sidenote: The code I posted last time for this question was
incorrect and would not work.)

The initial HTML looks like this:

   <input class="proxy" type="submit" value="Save">

After jQuery has done it's thing it look like this:

   <input type="submit" class="proxy" value="Save" style="display:none">
   <a href="#" class="proxy">Save</a>

And voila, you have a link you can style to your heart's content the
functions just like the normal submit button.

Karl Rudd

On 5/22/07, james_027 <[EMAIL PROTECTED]> wrote:

Hi,

Is this the best way to make a text button?

<a href="#">Click Me!</a>

It's nice that even with using <a href="#"> jquery could make almost
any tag to have click event, but the problem is the cursor doesn't
indicate that it's clickable.

Thanks in advance for any tips, suggestion, guides

cheers,
james


Reply via email to