Saturday, 15 February 2014

javascript - create an a link html and perform an action with jQuery? -


I have a jquery that makes a code when you click on a.data The problem is that when I make many a.data with another function, this does not work

I do not understand the new < Why code> a.data does not work?

This new a.data code> divdata

  var data_html = '& lt; A class = "data" href = "#" value = "'data.id'" & gt; ' + Ref.info + '& lt; / A & gt; '; $ (Data_html) .prependTo ($ ('# divdata'));   

It acts on the related a.data

  $ ('a.data'). Click (function () ($ (this) .attr ('href'); var idvalue = $ (this) .attr ('value'); idvalue * = 1; // Aqui resio to ACACIN console.log (idvalue };}};  
= "post-text" itemprop = "text">

Your binding method is only linked to existing elements, after that To be bound on the elements, you need to bind to the original element.

  $ ("# divdata"). ("Click", "a.data", function ( ) {// event content here});    

No comments:

Post a Comment