SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    replace a class = lightbox with rel = lightbox

    Hi there, I'm trying to integrate lightbox custom option in tinymce editor and I've found solution on this page
    http://www.bibblan.com/martin/tinymce-rel-with-lightbox
    My page is not able to replace a class="lightbox" to rel="lightbox".

    Here is my code on render page
    HTML Code:
    <!-- START REL LIGHTBOX HELPER -->
    <script src="includes/lightbox/js/rel_lightbox_helper.js" type="text/javascript"> </script>
    <!-- END REL LIGHTBOX HELPER -->
        
    <?php
    <HTML>
    <HEAD> </HEAD>
        <TITLE></TITLE>
        <BODY>
    
            <font size="1" color="red"> Do 2020. Intelovi čipovi u mozgu </font>
           <h1><p><strong><a class="lightbox" href="includes/forms/tiny_mce/plugins/imagemanager/files/it/googleAD.jpg"><img style="float: left;" src="includes/forms/tiny_mce/plugins/imagemanager/files/it/googleAD.jpg" alt="google ad" width="131" height="75" /></a>test content</p></h1><br />
    
           <font size="2" color="orange"> intel, chip, brain </font>
        </BODY>
    </HTML>
    
    ?>
    my helper.js code is
    HTML Code:
    	document.observe('dom:loaded', function () {
    		$$('#left a[class^=lightbox]').each(function(s) {
    			s.rel = 'lightbox';
    		});
    	});

  2. #2
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you need to specify the value of rel as an attribute:

    HTML Code:
    s.attr('rel':'lightbox');
    From the English nation to a US location.

  3. #3
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    s.rel = 'lightbox' should work (as would s.setAttribute('rel', 'lightbox')), if s is a reference to a proper DOM Element and not some other object, like jQuery tends to deal with.

    awestmoreland, it seems you're assuming he's using jQuery. That code won't work without jQuery.

    Make sure s is a proper DOM element, or use some equivalent in whatever library you're using.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •