javascript - alert a value from a cloned link being wrapped by a cloned phrase -


Good morning all,

I slept on my problem, but I did syntax as I like JavaScript and jQuery I am relatively new to

So, I thought that this kind of phrase is to be cloned:

  & lt; P & gt; & Lt; A href = "#" class = "myClass" & gt; [1] & lt; / A & gt;  
  var clone = $ ("p"). Clone ();    

/ Code>

I now want to add a checkbox to each phrase

  var clone = $ ("P"). Clone () Prepaid ("& lt; input type = 'checkbox' id = 'checked' checked & gt;");   

looks like HTML-structure:

  & lt; P & gt; & Lt; Input type = "checkbox" check = "" id = "check" & gt; & Lt; A href = "#" class = "myClass" & gt; [1] & lt; / A & gt; & Lt; / P & gt;   

The following is the hardest part for me: I am trying to get a warning with the check box marks, when the checkbox is checked in the value such as "[" or "]" There should be no bracket I feel that I have to work with regular expressions (like;);

My ultimate goal is to include the value of the link in a textile.

Can you help me

>

It looks like:

  var clone = $ ("p"). Clone () Prepaid ($ (''  ', {id:' check ', type:' checkbox ', checked:' check ', change: function () {if (check it) {Warning ( $ (This) .next ('a'). Text (). Match (/ ^ \ [(\ D +) \] $ /) [1]);}}})). Attachment (document; body / * or elsewhere * /);   

Demo :

Comments