Dynamic Callback
Dynamic Callback
-
$(document).ready(function(){
$("a#up").click(function() {
var up = "strong#" + $(this).attr("title");
$(up).html("next number");
});
});
-
<li>Attack: <strong id='atk'>{$attack}</strong> - <a href='#' id='up' title='atk'>Up</a></li>
<li>Defense: <strong id='def'>{$defense}</strong> - <a href='#' id='up' title='def'>Up</a></li>
Apparently, I'm not allowed to use variables like that. How can I get it so any "a#up" link clicked with its unique 'title' will change the text inside the "strong#whateverid"?
PS. I'm not sure what the $("inside") part is called lol... but I think it's the callback, plz correct me if I'm wrong.