jQuery Delegation with Facebox -


Hello, I'm not sharing the code. The problem is in this code. Please note. (Problem: I want to open Facebox every time I am not working properly with Post Ajax Facebox also. How do I use the jQuery delegation with this event?)

  & lt ;! DOCTYPE html & gt; & Lt; Html lang = "en" & gt; & Lt; Top & gt; & Lt; Link rel = "stylesheet" href = "facebox / facebox.css" type = "text / css" /> & Lt; / Head & gt; & Lt; Body & gt; & Lt; Ul id = "item" & gt; & Lt; Li & gt; & Lt; A href = '#' & gt; Clone Object & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = '# test' rel = 'facebox' & gt; Click to open Facebox & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div id = "test" style = "display: none;" & Gt; This is my test div & lt; / Div & gt; & Lt; Script type = "text / javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "facebox / facebox.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; JQuery ('a [rel * = facebox]') facebox () .; $ ("#team"). Representative ('a', 'click', function () {$ (this) .Parent () .appand (' 

Some things, switching to this, using the first change:

.
  jQuery ('a [rel * = facebox]') facebox ();  

For this:

  jQuery ('a [rel * = facebox]'). Live ('click', function (e) {$ .facebook ({div: this.hash}); E.Pretent Default ();});  

or version:

  $ ('# items'). Representative ('a [rel * = facebox]', 'click', function (e) {$ .facebox ({div: this.hash}); e.preventDefault ();});  

Then your call ; to and

  • gt; , instead you should change it:

    $ (this). Parent ()

    with this & lt; Ul & gt; and adds it as a child there , like this:

      $ (this) .closest ("ul") < / Code> 

    .


  • Comments