Jquery ticker in a drupal block isn't working I'm trying to add this ticker type to my site: http://cektkp.com/twittermarquee/.

I've created a new module to do so, and this is my module dir structure:

 module stocksTicker:
       1. stocksTicker.info
       2. js/
       3. images/
       4. stocksTicker.module

    js/:
       1. marqueeTicker.js

    images/:
       1.fade-trends2.png
       2.trendtip-pointer.gif



I enabled this module and added css to the block configuration from here: http://cektkp.com/twittermarquee/front.css.
I copied the .js file from here: http://cektkp.com/twittermarquee/twitmarquee.js to path/to/module/js/ directory. 
Images are in path/to/module/images dir too. 


This is my stocksTicker.module file:

/**
 * Declare what blocks are provided
 * by this module.
 */
function stocksTicker_block_info() {
  $blocks['bseTicker'] = array(
    'info' =&gt; t('BSE'),
    'cache' =&gt; DRUPAL_NO_CACHE,
  );
  return $blocks;
}

/**
 * Return a rendered view of the block.
 */
function stocksTicker_block_view($delta) {
  $block = array();
  switch ($delta) {
    case 'bseTicker':
      $block = getBSETicker();
      break;
  }
  return $block;
}

/**
 * This function does the real work of getting
 * the stocks info and marking it up &amp; produces
 * it in a renderable format.
 */
function getBSETicker() {
  $path = drupal_get_path('module', 'stocksTicker').'/js/marqueeTicker.js';
  $content = "&lt;div id=\"header\"&gt;&lt;div id=\"trends\"&gt;&lt;div class=\"inner\"&gt;&lt;ul class=\"trendscontent\"&gt;&lt;li class=\"trend-label\"&gt;Trending topics&lt;/li&gt;";
  $stockEntry = array("Stock1","Stock2","Stock3", "Stock4", "Stock5", "Stock6", "Stock7", "Stock8", "Stock9", "Stock10");
  foreach ($stockEntry as &amp;$stock) {
       $content = $content . "&lt;li&gt;&lt;a href=\"search?q=". $stock. "\" class=\"search_link\" name=\"". $stock. "\" rel=\"nofollow\"&gt;" . $stock. "&lt;/a&gt;&lt;em class=\"description\"&gt;This 
is description.&lt;/em&gt;&lt;/li&gt;";
  }     

$content = $content . "&lt;/ul&gt;&lt;/div&gt;&lt;span class=\"fade fade-left\"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=\"fade fade-right\"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=\"trendtip\"&gt;&lt;div class=\"trendtip-content\"&gt;&lt;div&gt;Trending right now:&lt;/div&gt;&lt;a class=\"trendtip-trend\"&gt;&lt;/a&gt;&lt;div class=\"trendtip-why\"&gt;Why?&lt;span class=\"trendtip-desc\"&gt;&lt;/span&gt;&lt;span class=\"trendtip-source\"&gt;Source: &lt;span&gt;What the Trend?&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=\"trendtip-pointer\"&gt;&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js\" type=\"text/javascript\"&gt;&lt;/script&gt;&lt;script type=\"text/javascript\"&gt;";

  $content = $content. "//&lt;![CDATA[";
  $content = $content. "var page={};";
  $content = $content. "$(function() {";
  $content = $content. "new FrontPage().init();";
  $content = $content. "});";
  $content = $content. "//]]&gt;";
  $content = $content. "&lt;/script&gt;";
  $block['content'] = array('#markup' =&gt; $content,
                            '#attached' =&gt; array('js'  =&gt; array($path),),);'
  return $block;
}


When I try to view the changes, I do get the list and I do see the css working just fine but none of the jquery feature works (scrolling/ tooltip anything..) which is the main aim of this exercise. Please tell me how can I fix this. 

I'm new to drupal so please excuse any silly mistake that I might have done.
In your js file, you are depending on the $(document).ready(function () {} ); to initialize your jquery stuff, but your content is being added via ajax ( if I understand correctly ), so this code will never fire, as the document is already loaded at that point.

This is the reason behaviors have been implemented in drupal.

If you change this to initialize your code in a drupal attached behavior, like so:

(function ($, Drupal, window, document, undefined) {
    Drupal.behaviors.stockTicker = {
        attach: function( context, settings ) {
            page.trendDescriptions = {};
            loadTrendDescriptions();
        }
    }
})(jQuery, Drupal, this, this.document);


or something of the sort, that may fix your problem. You'll need to look into the once() function, to prevent the code from running every time any content is added to the page, but for now, try a behavior and see if you get js behavior