I need to hide some element with some condition using jquery inside ctools modal popup in drupal after popup load. I used drupal_add_js but that not work.

Any suggestion?

2 Answers 2


You must use: ctools_ajax_command_attr('selector','attr','value'); do perform any kind of actions in popup. For more you can read: http://drupalcontrib.org/api/drupal/contributions!ctools!includes!ajax.inc/7


into custom modal style where you outputing your page callback add ctools_add_js('your_js_file_without_extension', 'MODULE_NAME');

then in js

jQuery(document).ready(function($) {
Drupal.behaviors.MODULE_NAME = {
  attach: function (context, settings) {

     //your jquery code...

}; });

For example you can copy ctools-ajax-samples.js from ctools directory and modify it as i did. This solution worked for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.