Answer the question
In order to leave comments, you need to log in
How to call from onClick() function in jQuery space?
How to run details() from onClick?
Drupal CMS is therefore "(function ($) { })(jQuery);"
<a onClick="details(11)"> Подробнее</a>
<script>
(function ($) {
function details(id){
$('#nameID'+id).dialog("open");
}
})(jQuery);
</script>
Answer the question
In order to leave comments, you need to log in
Outside the closure - no way.
Drupal has a global object for this Drupal
. Example:
(function ($) {
Drupal.mymodule = Drupal.mymodule || {
details: function (id) {
$('#nameID'+id).dialog("open");
}
};
})(jQuery);
Drupal.mymodule.details(...);
Either hook the onClick event with a script inside the closure, or declare the details function in global visibility.
hang events via onclick - a crutch solution, hang an event inside a closure
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question