Increasing value by one

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dada1
    New Member
    • Jul 2008
    • 15

    Increasing value by one

    THis is my html code
    Code:
    <div class="icon_info"><a href="#" data-tooltip="sticky1">
    <img src="images/info_icon.png" alt="info"></a></div>
    <!--HTML for the tooltips-->
    <div id="mystickytooltip" class="stickytooltip">
    <div style="padding:5px">
    
    <div id="sticky1" class="atip" style="width:200px">
    Every time new test
    </div>
    </div>
    <!--HTML for the tooltips-->
    I have PHP script where it generate new text every time user submits it.

    Is it possible to make with javascript to add here "sticky1" new number every time user submits text
    something like
    Code:
    <a href="#" data-tooltip="[B]sticky2[/B]">
    <img src="images/info_icon.png" alt="info"></a>
    Code:
    <a href="#" data-tooltip="[B]sticky3[/B]">
    <img src="images/info_icon.png" alt="info"></a>
    Code:
    <a href="#" data-tooltip="[B]sticky4[/B]">
    <img src="images/info_icon.png" alt="info"></a>
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    you might give your href-node an id and then set the attribute's value like this:

    Code:
    <a href="#" id="myNode" data-tooltip="sticky2">
    and JavaScript to set the attribute's value (example):

    Code:
    var myNode = document.getElementById('myNode');
    myNode.setAttribute('data-tooltip', 'sticky3');

    Comment

    Working...