jeudi 26 février 2015

jQuery - How to make clickable a var text placed in another var composed by more elements (var, checkbox)

I've made a var element (artwork_html) to append in a div (append_div):


This element is formed by: a checkbox with a value + class and a Name that contains text (text that comes from an array and is been modified replacing some parts of it).



var name;
var artwork_html = "";
name = value['artwork']['value'].replace("http://ift.tt/177k8UM", "");

artwork_html += "<div><b>" +'<input class=artworks_checkbox type=checkbox value='+ value['artwork']['value'] + '/>' + " " + name + "</b></div>";

$('#append_div').append(artwork_html);


That creates a checkbox and a text (the var name) like this:



[] Primavera_(Botticelli)
[] Nascita_di_Venere_(Botticelli)
[] Bacco_(Caravaggio)


How can i click on the name firing a simple event



alert("Name Clicked!");


thanks in advance





Aucun commentaire:

Enregistrer un commentaire