Jean R.
Jean R.

Reputation: 534

Create a dynamic id in my html code

i take a plugin from web to create dynamic tabs. I tried to adapt the code according to my wishes but i need to create a dynamic id. Here the code :

function addNewStaticTab()
{
    $.addDynaTab({
        tabID : 'addstatictab',
        type : 'html',
        html : "<table class='fontStreet' width='100%'> <tr> <td align='left' class='td-label'>Intitulé*</td> <td width='2%'>&nbsp;</td> <td align='left' width='150'><input type='text' class='input-middle' required></td> <td> <figure onclick='makeCaptionAppear('figcaptionRosterInt');' style='position:relative; padding:0px; margin:0px;' ><img src='img/inter.png' id='buttonCriteresLeft'><figcaption class='figcaptionRoster2' id='figcaptionRosterInt' onMouseOut='makeCaptionDisappear('figcaptionRosterInt');'>Aide:<br> Exemples d'intitulés :<br>Projet, développement commercial, développement international, En création, prestataire, apporteur d'affaires, recherche d'emploi/opportunités, etc.</figcaption></figure> </td> </tr> </table>",
        params : {},
        tabTitle : 'NOUVELLE ACTIVITÉ'
    });
}

Where the id is "figcaptionRosterInt" i need to change it to a dynamic id. As you can see i call a fonction to open an another div popup who needs IDs but even if the window is the same in other tabs, the id need to be unique..

I don't know if you understand, sorry for my english.

thank you in advance for your answers.

Upvotes: 1

Views: 1567

Answers (1)

Merlin
Merlin

Reputation: 4917

If I understand your question you can achieve this by adding a parameter to the addNewStaticTab function

function addNewStaticTab(parameter_id)
{
    $.addDynaTab({
        tabID : 'addstatictab',
        type : 'html',
        html : "<table class='fontStreet' width='100%'> <tr> <td align='left' class='td-label'>Intitulé*</td> <td width='2%'>&nbsp;</td> <td align='left' width='150'><input type='text' class='input-middle' required></td> <td> <figure onclick='makeCaptionAppear('+ parameter_id +');' style='position:relative; padding:0px; margin:0px;' ><img src='img/inter.png' id='buttonCriteresLeft'><figcaption class='figcaptionRoster2' id='+ parameter_id +' onMouseOut='makeCaptionDisappear('+ parameter_id +');'>Aide:<br> Exemples d'intitulés :<br>Projet, développement commercial, développement international, En création, prestataire, apporteur d'affaires, recherche d'emploi/opportunités, etc.</figcaption></figure> </td> </tr> </table>",
        params : {},
        tabTitle : 'NOUVELLE ACTIVITÉ'
    });
}

Upvotes: 1

Related Questions