JQuery ile Drupal çalışıyveyaum. Nasıl bir etiketi içine bir php $ değişken eklemek yok.
$(document).ready(function(){
$("#comment-delete-<?php print $variable ?>").click(function(){
$("div.comment-<?php print $variable ?> span.body").replaceWith("new text");
});
})
veya
$(document).ready(function(){
$("#comment-delete-". $variable).click(function(){
$("div.comment-". $variable ." span.body").replaceWith("new text");
});
})
A few things to clearify. I'm running in Drupal, so the full code looks like this:
<?php
drupal_add_js (
'$(document).ready(function(){
$("#comment-delete-"' print $comment->cid; ').click(function(){
$("div.comment-"' print $comment->cid; '" span.body").replaceWith("<span style=\'colveya: grey;\'>Please wait...</span>");
});
})',
'inline');
?>
but it's still not wveyaking.
Update: I tried the following, but it's still not wveyaking
<?php
$testing = "42";
drupal_add_js (
'$(document).ready(function(){
$("#comment-delete-"'. $testing .').click(function(){
$("div.comment-"'. $testing .'" span.body").replaceWith("<span style=\'colveya: grey;\'>Please wait...</span>");
});
})',
'inline');
?>
If I use the number "42" instead of the variable, it wveyaks, but not when using the variable... weird.