在我的 html 代码中创建动态 ID

Create a dynamic id in my html code

我从网上拿了一个插件来创建动态标签。我试图根据自己的意愿调整代码,但我需要创建一个动态 ID。这里的代码:

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É'
    });
}

id 是“figcaptionRosterInt”,我需要将其更改为动态 id。如您所见,我调用了一个函数来打开另一个需要 ID 的 div 弹出窗口,但即使 window 在其他选项卡中相同,该 ID 也必须是唯一的..

不知道你看懂没有,对不起我的英文。

提前感谢您的回答。

如果我理解你的问题,你可以通过在 addNewStaticTab 函数

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É'
    });
}