[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

html unique id attribute

Posted on 2012-09-17
18
Medium Priority
?
162 Views
Last Modified: 2013-03-15
Hi,

In order to create 2 different connections through 2 different links,
I have to add the following code in 2 parts of the html code:

<a id="enabled_element" href="#">

As the id attribute should be unique, only the first link is active.

How can I do to activated also the second link?

Thanks for pointing me in the right direction.
0
Comment
Question by:lupire
  • 7
  • 6
  • 2
  • +1
16 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 38406526
Can you use class="enabled_element" instead?

EDIT:  I just realized you are probably referring to Outlook Groupware connections of which I am not familiar.
0
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 38406598
Why does the element have to have the same id - which is obviously not allowed - what is the importance of the enabled_element id - with respect to your code?

Please post more information about your problem - the information you have given is not sufficient for us to be able to assist you.
0
 
LVL 83

Expert Comment

by:leakim971
ID: 38406715
I think it appear disabled/enabled with CSS so, locate the CSS file, look for :

#enabled_element

and replace: #enabled_element
by : #enabled_element, #enabled_element_second

<a id="enabled_element" href="#">
<a id="enabled_element_second" href="#">

Open in new window


or just use a class as suggested by tommyBoy, so replace : #enabled_element
by : .enabled_element

<a class="enabled_element" href="#">
<a class="enabled_element" href="#">

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lupire
ID: 38406751
I have to use the id attribute.
When the application stars, it checks the site content for the specific ID (enabled_element). If these IDs are used on a element, then clicking this element will start an action.
It is because the enabled_element is unique.

But I would like to acivate the action on two different elements of the page.

I cannot use class.

Many thanks
0
 
LVL 83

Expert Comment

by:leakim971
ID: 38406840
>When the application stars, it checks the site content for the specific ID

Could you post(show us) this part?
Could you edit it?
0
 

Author Comment

by:lupire
ID: 38406878
>>When the application starts, it checks the site content for the specific ID

>Could you post(show us) this part?
>Could you edit it?

Unfortunately I can not edit the code application, I have only to configured the web site.
0
 
LVL 83

Expert Comment

by:leakim971
ID: 38406983
try this :
<a id="enabled_element1" href="#" onclick="this.id='enabled_element';">
<a id="enabled_element2" href="#" onclick="this.id='enabled_element';">

Open in new window


good luck...
0
 

Author Comment

by:lupire
ID: 38407232
<a id="enabled_element1" href="#" onclick="this.id='enabled_element';">
<a id="enabled_element2" href="#" onclick="this.id='enabled_element';">
                                           

I have to click twice on an element to start the action. But after I can not start the action on the other element.

I seems after having clicked on an element, the id remains setted on the clicked ID.

The only way to start the action on the other element is to reload the page.

Thanks for your help
0
 
LVL 83

Expert Comment

by:leakim971
ID: 38407293
ok, could you post the code setting the "action"?
0
 

Author Comment

by:lupire
ID: 38407346
I am not allowed to modify this code.
0
 
LVL 83

Expert Comment

by:leakim971
ID: 38407365
>I am not allowed to modify this code.

I don't want to see it to ask you to modify it...
0
 

Author Comment

by:lupire
ID: 38407406
here is the code:

function() {
      ka.c = [];
      ka.registerApiConsumer = function(callback, apiNames) {
            ka.c.push({a: apiNames, c: callback});
      }      
      ka.setLocale = function(locale) {
            ka.l = locale;
      }
      function h(a, b, c) {
            if (a.addEventListener) a.addEventListener(b, c, false);
            else if (a.attachEvent) a.attachEvent("on" + b, c, true);
      }
      h(window, "DOMContentLoaded", function() {window["x-ka-tmp-dom-ready"] = true;}, false);
      h(window, "load", function() {window["x-ka-tmp-window-alive"] = true;});
      if (!window["x-ka-tmp-window-name"]) window["x-ka-tmp-window-name"]=window.name;
      var q = document.getElementsByTagName("script")[0];
      if (q) {
            var g = document.createElement("script");
            g.setAttribute("src", "https://start.ka.biz/starter.js");
            g.setAttribute("type", "text/javascript");
            g.setAttribute("defer","defer");
            q.parentNode.appendChild(g);
            h(g, "load", function() {});
            h(g, "error", function() {});
      }
})();

many thanks
0
 
LVL 83

Expert Comment

by:leakim971
ID: 38407507
looking for : start.ka.biz/starter.js
0
 
LVL 60

Accepted Solution

by:
Julian Hansen earned 2000 total points
ID: 38408473
bottom line - you cannot have duplicate ID's only the last one will count.
0
 
LVL 83

Expert Comment

by:leakim971
ID: 38409072
could you post the code of : start.ka.biz/starter.js ?
0
 

Author Comment

by:lupire
ID: 38409860
I am not allowed to post it.
Thanks
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
Take a look at these 6 Outlook Email management tools which can augment the working and performance of Microsoft Outlook to give you a more rewarding emailing experience.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question