You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ro...@consult.nordea.com on 2012/11/23 12:41:36 UTC

Force Ajax onClick event on empty

Hi all

I seem to struggle more than expected on this scenario: An empty <A> tag wont trigger Ajax

HTML is pretty simple
<span class="myIcon" " id="id3192">
<a href="../page?3-2.ILinkListener-navigation-navigation_body-wmc-left-4-comp-content-tabs-panel-body-rows-5-cells-2-cell-3-link" id="link17a">
</a>
</span>

myIcon {
    background: url("../img/myImg.png");

Whats the trick? should I use some transparent text approach or? any experiences here to share?

Thanks in advance!

/Ronny

Re: Force Ajax onClick event on empty

Posted by Martin Grigorov <mg...@apache.org>.
On Fri, Nov 23, 2012 at 4:22 PM, Nick Pratt <nb...@gmail.com> wrote:

> Try putting a non-breaking space in there:
>
> <a>&nbsp;</a>
>

And then only this space character will be clickable.
Better wrap the <span> in <a>:

<a ...><span>...</span></a>


>
>
> On Fri, Nov 23, 2012 at 6:41 AM, <Ro...@consult.nordea.com> wrote:
>
> > Hi all
> >
> > I seem to struggle more than expected on this scenario: An empty <A> tag
> > wont trigger Ajax
> >
> > HTML is pretty simple
> > <span class="myIcon" " id="id3192">
> > <a
> >
> href="../page?3-2.ILinkListener-navigation-navigation_body-wmc-left-4-comp-content-tabs-panel-body-rows-5-cells-2-cell-3-link"
> > id="link17a">
> > </a>
> > </span>
> >
> > myIcon {
> >     background: url("../img/myImg.png");
> >
> > Whats the trick? should I use some transparent text approach or? any
> > experiences here to share?
> >
> > Thanks in advance!
> >
> > /Ronny
> >
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Force Ajax onClick event on empty

Posted by Nick Pratt <nb...@gmail.com>.
Try putting a non-breaking space in there:

<a>&nbsp;</a>


On Fri, Nov 23, 2012 at 6:41 AM, <Ro...@consult.nordea.com> wrote:

> Hi all
>
> I seem to struggle more than expected on this scenario: An empty <A> tag
> wont trigger Ajax
>
> HTML is pretty simple
> <span class="myIcon" " id="id3192">
> <a
> href="../page?3-2.ILinkListener-navigation-navigation_body-wmc-left-4-comp-content-tabs-panel-body-rows-5-cells-2-cell-3-link"
> id="link17a">
> </a>
> </span>
>
> myIcon {
>     background: url("../img/myImg.png");
>
> Whats the trick? should I use some transparent text approach or? any
> experiences here to share?
>
> Thanks in advance!
>
> /Ronny
>

Re: Force Ajax onClick event on empty

Posted by Thomas Götz <to...@decoded.de>.
Ajax works also with empty tags, but your link does not receive click events because of the surrounding span (which gets the click events).

Try this:

<a wicket:id="link" class="myIcon"></a>

.myIcon {
    background: url("...");
    display: inline-block;
    height: XXXpx;
    width:  YYYpx;
}


Cheers,
   -Tom

			
On 23.11.2012, at 12:41, Ronny.Voss@consult.nordea.com wrote:

> Hi all
> 
> I seem to struggle more than expected on this scenario: An empty <A> tag wont trigger Ajax
> 
> HTML is pretty simple
> <span class="myIcon" " id="id3192">
> <a href="../page?3-2.ILinkListener-navigation-navigation_body-wmc-left-4-comp-content-tabs-panel-body-rows-5-cells-2-cell-3-link" id="link17a">
> </a>
> </span>
> 
> myIcon {
>    background: url("../img/myImg.png");
> 
> Whats the trick? should I use some transparent text approach or? any experiences here to share?
> 
> Thanks in advance!
> 
> /Ronny


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org