so I was trying to implement a submenu within a submenu on a navigation bar. The idea is to have the submenu &quot;reports management&quot; generates when the Report is clicked. The code as below. HTML          &lt;li class=&quot;drop-down&quot;&gt;&lt;a href=&quot;#&quot; id=&quot;btnFileMgmt&quot;&gt;File &amp;nbsp; &lt;i class=&quot;icofont-document-folder&quot;&gt;&lt;/i&gt;&lt;/a&gt;           &lt;ul id=&quot;filesMgmt&quot;&gt;                          &lt;/ul&gt;         &lt;/li&gt;  JQuery  $(document).ready(function(){         var files_management = '&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;btnViewFiles&quot;&gt;View Files&lt;/a&gt;&lt;/li&gt;' +                               '&lt;li class=&quot;drop-down&quot;&gt;&lt;a href=&quot;#&quot; id=&quot;btnReports&quot;&gt; Reports &lt;/a&gt;' +                                  '&lt;ul id=&quot;reportsMgmt&quot;&gt;' +                                  '&lt;/ul&gt;' +                              '&lt;/li&gt;';        var reports_management = '&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;fileList&quot;&gt;Files&lt;/a&gt;&lt;/li&gt;' +                                 '&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;borrowList&quot;&gt;Borrowed Files&lt;/a&gt;&lt;/li&gt;';         $(&quot;#btnFileMgmt&quot;).click(function(){           $(&quot;#filesMgmt&quot;).append(files_management);       });        $(&quot;#btnReports&quot;).click(function(){           $(&quot;#reportsMgmt&quot;).append(reports_management);       });   But I don't understand is it the limitation or the way I using is wrong because it wouldn't generate when the Reports inside the Files is clicked.
112
I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.
96273
I need to implement a custom block using JavaScript. These are the steps I took.   I created a custom module I created a custom block by creating a class which extends blockbase I created a JavaScript file I defined a library in libraries.yml file and included the JavaScript file I attached the library to the block using #attached   So far so good. In the JavaScript file, I am trying to use the open source Datatables library, but I am unable to add it.  This is the code that implements the block.  /**  * @file  * Contains \Drupal\custom_cms_blocks\Plugin\Block\TopNewsBlock.  */  namespace Drupal\custom_cms_blocks\Plugin\Block;  use Drupal\Core\Block\BlockBase;  /**  * Provides an 'Active forum topics' block.  *  * @Block(  *   id = "top_news_min_block",  *   admin_label = @Translation("Top News Min Block"),  *   category = @Translation("Custom CMS blocks"),  * )  */ class TopNewsBlock extends BlockBase {    /**    * {@inheritdoc}    */   public function build() {      //Fetch data      return array(       'type' =&gt; 'markup',       '#markup' =&gt; '&lt;table id="example_table"&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Artist / Band&lt;/th&gt;&lt;th&gt;Album&lt;/th&gt;&lt;th&gt;Song&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Muse&lt;/td&gt;&lt;td&gt;Absolution&lt;/td&gt;&lt;td&gt;Sing for Absolution&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;',       '#attached' =&gt; array(         'library' =&gt;  array(                 'https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js',           'custom_cms_blocks/top-news-library'         ),       ),      );    }   }   Can you explain me how I can include an external JavaScript file in a block?
23360
I want to use jQuery inside a firefox extension, I imported the library in the xul file like this:  &lt;script type="application/x-javascript" src="chrome://myExtension/content/jquery.js"&gt; &lt;/script&gt;   but the $() function is not recognized in the xul file neither do the jQuery().  I googled about the problem and found some solutions but no one did work with me:    I've also tried to pass the 'content.document' object(which refrences the 'document' object) as the context parameter to the jQuery function like this:  $('img',content.document);   but still not working, does any one came across this problem before?
105678
My code looks like this:  &lt;ul id="ulList"&gt;   &lt;li class="listClass" id="id1"&gt;&lt;a href="http://link1"&gt;Link 1&lt;/a&gt;&lt;/li&gt;   &lt;li class="listClass" id="id2"&gt;&lt;a href="http://link2"&gt;Link 2&lt;/a&gt;&lt;/li&gt;   &lt;li class="listClass" id="id3"&gt;&lt;a href="http://link3"&gt;Link 3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;   Now I like to get the following:  All links as an array  All ids of li as an array  Can someone help me please?
30791
I give a lecture with 10 sections and maybe 5-10 subsections. Using the Warsaw theme would make the available space too small.   Is there a way to make the navigation bar show:   only the last section, current section and the next two sections? only the last subsection, current subsection and the next two subsections?   If there is not an option, one may have to change the \insertsubsectionnavigation-function.  Maybe something like   \insertsubsectionnavigation["\thissectionnumber-1" to "\thissectionnumber+2"]    The problem is: I don't understand the way this function works.  Does anyone have an idea or a link to a similar topic?  Here is an example of how it should NOT look:  \documentclass{beamer} \usetheme{Warsaw} \begin{document}     \section{Section 1}     \section{Section 2}     \section{Section 3}     \section{Section 4}         \subsection{SubSection a}\begin{frame}Test\end{frame}         \subsection{SubSection b}\begin{frame}Test\end{frame}         \subsection{SubSection c}\begin{frame}Test\end{frame}         \subsection{SubSection d}\begin{frame}Test\end{frame}         \subsection{SubSection e}\begin{frame}Test\end{frame}         \subsection{SubSection f}\begin{frame}Test\end{frame}         \subsection{SubSection g}\begin{frame}Test\end{frame}         \subsection{SubSection h}\begin{frame}Test\end{frame}         \subsection{SubSection i}\begin{frame}Test\end{frame}     \section{Section 5}     \section{Section 6}     \section{Section 7}\begin{frame}Test\end{frame} \end{document}   A slide would look like:   I want it to look like:
55301
i have this code but its not working it throws syntax error, unexpected '}' error  function my_custom_menu_item($items, $args) {     if(is_user_logged_in() &amp;&amp; $args-&gt;theme_location == 'primary')     {         $user=wp_get_current_user();         $name=$user-&gt;display_name; // or user_login , user_firstname, user_lastname         $items .= '&lt;li&gt;&lt;a href=""&gt;Welcome '.$name.'&lt;/a&gt;&lt;/li&gt;';         $items.= //Change Password, Logout, etc     }     elseif (!is_user_logged_in() &amp;&amp; $args-&gt;theme_location == 'primary') {         $items .= '&lt;li&gt;&lt;a href="'. site_url('wp-login.php') .'"&gt;Log In&lt;/a&gt;&lt;/li&gt;';         $items.= //Sign up, Lost Password     }     return $items; } add_filter( 'wp_nav_menu_items', 'my_custom_menu_item');
50386
I have a code, that outputs a standard pager:  print theme('pager');   it outputs this:  &lt;h2 class="element-invisible"&gt;Pages&lt;/h2&gt; &lt;div class="item-list"&gt; &lt;ul class="pager"&gt;&lt;li class="pager-current first"&gt;1&lt;/li&gt; &lt;li class="pager-item"&gt;&lt;a title="Go to page 2" href="/drupal/node?page=1"&gt;2&lt;/a&gt;&lt;/li&gt; &lt;li class="pager-item"&gt;&lt;a title="Go to page 3" href="/drupal/node?page=2"&gt;3&lt;/a&gt;&lt;/li&gt; &lt;li class="pager-next"&gt;&lt;a title="Go to next page" href="/drupal/node?page=1"&gt;next ›&lt;/a&gt;&lt;/li&gt; &lt;li class="pager-last last"&gt;&lt;a title="Go to last page" href="/drupal/node?page=5"&gt;last »&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;   How can I change the HTML to something like this:  &lt;ul class="pagination"&gt;     &lt;li&gt;&lt;a href="#"&gt;&amp;lt;&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href="#"&gt;1&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href="#" class="active"&gt;2&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href="#"&gt;3&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href="#"&gt;&amp;gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;   I looked into this thread: , created a function bartik_preprocess_custom_pager and a file custom-pager.tpl.php inside my Bartic theme templates, but I can't make it work.  print theme('custom_pager');   outputs nothing. Does anybody know, how can I customize the HTML output for a pager, creating one just for 1 page?
116321
&lt;template&gt;            &lt;lightning-card&gt;                     &lt;lightning-input type=&quot;text&quot; label=&quot;field1&quot; name=&quot;field1&quot; onchange={handleChange}&gt;&lt;/lightning-input&gt;                     &lt;lightning-input type=&quot;text&quot; label=&quot;field2&quot; name=&quot;field2&quot; onchange={handleChange}&gt;&lt;/lightning-input&gt;                     &lt;lightning-input type=&quot;text&quot; label=&quot;field3&quot; name=&quot;field3&quot; onchange={handleChange}&gt;&lt;/lightning-input&gt;                     &lt;div if:true={errorMsg} style=&quot;margin-left: 0%;&quot;&gt;                         &lt;p style=&quot;color: red;&quot;&gt;{errorMsg}&lt;/p&gt;                     &lt;/div&gt;                 &lt;/lightning-card&gt;         &lt;div style=&quot;float: right&quot; class=&quot;slds-p-bottom--large&quot;&gt;         &lt;lightning-button class=&quot;slds-m-left_x-small&quot; label=&quot;Previous&quot; onclick={handlePrevious}&gt;         &lt;/lightning-button&gt;         &lt;lightning-button class=&quot;slds-m-left_x-small&quot; label=&quot;Next&quot; variant=&quot;brand&quot; onclick={handleNext}&gt;         &lt;/lightning-button&gt;     &lt;/div&gt; &lt;/template&gt;  We have above lwc component, which is embedded in screenflow. and the screen flow previous,next buttons are overrided by using Flow Navigation Events. So when we clicked on Previous button, we are facing  class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')
82828
I've searched and found variations of this question but I've never found an answer that seemed to work. I need to add a class to the &lt;li&gt; elements, currently the main menu is rendered like this:  print theme('links__system_main_menu', array(     'links' =&gt; $main_menu,     'attributes' =&gt; array(         'id' =&gt; 'slidemenu',         'class' =&gt; array(             'links',             'inline',             'clearfix'         )     ),     'heading' =&gt; t('') ));   As far as I can tell, this only sets up the &lt;ul&gt; element of the main menu, so I was wondering if there's a way to edit the attributes of the 'links' part.  ---EDIT---  Alright, I think I solved it. Apparently you can use theme_links__system_main_menu in templates to override the whole thing. I ended up doing this:  function mytheme_links__system_main_menu($variables) {     $html = '&lt;div id="mainmenu"&gt;';     $html .= '  &lt;ul id="slidemenu" class="clearfix"&gt;';      static $linkClass = 1;      foreach ($variables['links'] as $link) {                         $html .= '&lt;li class="themastyle' . $linkClass . '"&gt;' . l($link['title'], $link['href'], $link) . '&lt;/li&gt;';         ++$linkClass;     }      $html .= '  &lt;/ul&gt;';     $html .= '&lt;/div&gt;';      return $html; }   Not entirely sure if this is correct Drupal, though it did solve my issue!
92519
I have HTML like the following on my website:  &lt;div class="groups"&gt;   &lt;div class="group"&gt;     Group 1 priority:     &lt;select&gt;       &lt;option value="1.0"&gt;1&lt;/option&gt;       &lt;option value="2.0" selected="selected"&gt;2&lt;/option&gt;       &lt;option value="3.0"&gt;3&lt;/option&gt;     &lt;/select&gt;   &lt;/div&gt;   &lt;div class="group"&gt;     Group 2 priority:     &lt;select&gt;       &lt;option value="1.0"&gt;1&lt;/option&gt;       &lt;option value="2.0"&gt;2&lt;/option&gt;       &lt;option value="3.0" selected="selected"&gt;3&lt;/option&gt;     &lt;/select&gt;   &lt;/div&gt;   &lt;div class="group"&gt;     Group 3 priority:     &lt;select&gt;       &lt;option value="1.0" selected="selected"&gt;1&lt;/option&gt;       &lt;option value="2.0"&gt;2&lt;/option&gt;       &lt;option value="3.0"&gt;3&lt;/option&gt;     &lt;/select&gt;   &lt;/div&gt; &lt;/div&gt;   I am looking for a way to sort the order these groups appear in the browser using jQuery, based on the what is selected in the dropdown. It should resort when the user selects a new value in any of the dropdowns, or on page load.  What would be the easiest approach to this problem?  I have jQuery UI available, if the sortable thing can be used in any way. I couldn't not find a way to use that.  Update: There is other data in the &lt;div class="group"&gt; that should follow the dropdowns wherever they are moved. The number of groups varies from 0 to 20.
27208
I have an HTML string representing an element: '&lt;li&gt;text&lt;/li&gt;'. I'd like to append it to an element in the DOM (a ul in my case). How can I do this with Prototype or with DOM methods?  (I know i could do this easily in jQuery, but unfortunately we're not using jQuery.)
19010
My  script has now gained quite a following (and it - allegedly - just got bust by upgrading to jQuery 1.7.1). This is a personal request to the team to consider adopting it.   Not that I don't wish to keep on maintaining it, but the next step (allowing users to define one global set of comments to be used across all their sites*) is pretty awkward for me to implement "from the outside", but would be comparatively trivial for the team (I believe).  Goes off to fix script...  * Note: I have a beta half-version of this; it requires   userscripts, and allows you to push/pull between "local" (site-specific) and "global" storage. And even if I get the global sharing 'properly' working, it would still only be for a given machine.
70184
We are attempting to get submenus to only appear when the user "taps" the menu option on a mobile browser. This functionality works good on hover but some mobile devices don't work with hovering. We need the ability to click submenu titles in order to drop them down and then click them again to collapse them.
106757
In thinking and reasoning about the new question navigation bar and trying to figure out where unnecessary and necessary redundancies are and what could be improved, I more often than not stumble across the problem that I don't really know what all those different options actually do, and neither of the two iterations of that official announcement question seems to completely explain it. I feel that any further question I'd ask might simply be an XY problem of not knowing what I want to improve at all. It might be clear to people deeply acquainted with the old navigation bar already what e.g. "recommended" actually means, but there are also other sub-options that seem to .  So hands down, what are the exact technical criteria (i.e. votes/answers/views whatever) that all the different tabs and their filtering/showing sub-options employ for filtering questions? I know what the tag filters do, or what the time filters in the "popular" tabs do, but especially some "show" options are a bit unclear to me, and others might be clear but I'd still like to have it canonically answered to be sure. In particular I'm having problems grasping the following options:  "new" tab   show: all vs show: recommended - That doesn't seem to filter only my favourite tags (for which there's a separate filter anyway), so what is recommended at all?   "popular" tab   sort: hot - Does this use the "arbitrary hotness points" of the HNQ or another hotness formula, or even other criteria in addition?   "need answer" tab   show: need answer vs show: no answer - I figure those are the good old "no accepted/upvoted answers" vs "no answer at all" options. But do they use additional criteria? I'm asking because some of the  in the old design had the unexpected behaviour of excluding negatively voted questions. show: all - What does this actually show? It seems to include questions with accepted answers, but how does it then differentiate from the show: all view in the "new" tab? Or maybe this even is absolutely intentional redundancy for easier usability?
48477
I am creating a new custom button or link, and when i try to use a Visualforce page my content dropdown list is empty. How do i get a VF page to trigger on a custom button or link.
4344
Is there a location where I can drop in a custom JavaScript file in Drupal 7.x?  It just includes simple event actions for menus, and I don't want to edit the theme/module files.  Or do I have to just add the "include" hook to the theme/module?
11801
I asked about it on  and they told me to post it here.  Probably need to add the :active to the :hover meta class or something like that.  Example:      Hammer Time