implémentation .live JQuery
Bonjour j'essaye d'implémenter .live dans mon javascript pour pouvoir sélectionner les éléments chargés par JQuery mais je n'arrive pas à l'implémenter correctement si vous pouviez me dire où je me trompe merci par avance
management.js :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
$(document).ready(function () {
$('a[@rel="management"]').click(function () {
$.post(
'management.php',
{ table: $(this).attr("href") },
function(data){
$('#content').html(data);
}
);
return false;
});
$("button").live("click", function(){
alert($(this).attr("rel"));
});
}); |
index.php
Code:
1 2 3 4 5 6 7 8 9
|
<body>
<div id="menu">
<button type="button">click me</button>
<li><a rel="management" href="Menu1">Menu1</a></li>
</menu>
<div id="content">
</div>
</body> |
management.php
Code:
1 2
|
<?php echo ('<button type="button" rel="'.$_POST['table'].'">'.$_POST['table'].'</button>')?> |