0

I have several jsp that I invoke, of which when I load the main page I include my jsp as attributes, the question is that ... When I load my main page, other jsp are loaded additionally. These are loaded, but when they load I get the following error. Multiple ids

Now, I need to know if there is any function in javascript or Jquery where I can eliminate these duplicates of id's or from html there is a repair. Without manually I search in all my pages and I have to change the id.

DANIEL
  • 27
  • 5
  • Not sure how using JavaScript would solve the problem. Not like the ids will not always be there. Fix the real issue, do not do a bandaid with jQuery. – epascarello Jan 08 '18 at 22:53

1 Answers1

0

Here is the answer: Changing an element's ID with jQuery

I would do it like that:

<script>
    $(document).ready(function () {
        $('form').each(function(index) {
            if(this.id) {
                this.id = this.id + index;
            }
        });
    });
</script>
D. Braun
  • 508
  • 1
  • 4
  • 11