On 12/1/06, Marc Jansen <[EMAIL PROTECTED]> wrote:
> Hi digital spaghetti,
>
> digital spaghetti schrieb:
> > Hey folks,
> >
> > I am working on a Microcontent module for Drupal that uses jQuery, but
> > I cannot seem to get that functionality to work.  I need to ask, does
> > .addClass actually add class text to a tag, or is it just applying it
> > in the background.  To explain, my code looks like this:
> >
> > $(function(){
> >      $("[EMAIL PROTECTED]").addClass("microid-' . $hash . '")
> > });
> >
> >
> Ignore this post if I totally miss something, but:
>
> What do the dots (.) around $hash do? Is $hash a jquery-variable? Some
> PHP? I thought you wanted to concatenate a classname as a string, but I
> can't see the JavaScript-plus-operator. (and the dots keep thinking me
> of PHP-concatenation)
>
> This is rather confusing... at least to me.
>

Hi Marc,

Ignore this - it's a PHP variable.  You are seeing this code out of
context as to add jQuery to a drupal page you use a function called
drupal_add_js:

drupal_add_js('$(function(){$("[EMAIL PROTECTED]").addClass("microid-' .
$hash . '")});', 'inline');

It's very handy, as it allows you to mix JS and PHP.  The 'inline' as
the end add's it to the header, without 'inline' you can add JS files
to your header.

Tane

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to