the browser). Is there a way to do something like $
("#myDiv").withTarget("#myScan")?
On Dec 31 2008, 9:42 pm, Kean <shenan...@gmail.com> wrote:
> $('#myScan').click() does not have event binded to it.
> It means fire myScan's click events, think very straightforward in
> this case.
>
> On the other hand, when you click on myScan it fires myDiv event
> because of bubbling.
>
> On Dec 31, 11:40 am, nachocab <nacho...@gmail.com> wrote:
>
> > Hi,
> > I was wondering how I could replicate event delegation while testing.
> > For example:
>
> > <div id="myDiv">
> > <scan id="myScan">hello</scan>
> > </div>
> > $('#myDiv').click(function(e) {
> > $this = $(e.target)
> > if ( $this.is('scan') )
> > $this.toggleClass("selectedScan")
>
> > });
>
> > When I click on the scan in the browser, it works. But if I do this it
> > doesn't:
> > $('#myScan').click()
>
> > Any help?
> > Thanks,
>
> > Nacho
No comments:
Post a Comment