Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9195791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:42:23+00:00 2026-06-17T21:42:23+00:00

Is it alright to define and use custom tags? (that will not conflict with

  • 0

Is it alright to define and use custom tags? (that will not conflict with future html tags) – while replacing/rendering those by changing outerHTML??

I created a demo below and it seems to work fine


    <!DOCTYPE HTML>
    <html lang="en-US">
    <head>
        <script type="text/javascript" src="jquery.min.js"></script>
    </head>

    <body>

    <div id="customtags">
        <c-TextField name="Username" ></c-TextField> <br/>
        <c-NameField name="name" id="c-NameField"></c-NameField> <br/>
        <c-TextArea name="description" ></c-TextArea> <br/>
        <blahblah c-t="d"></blahblah>
    </div>
    </body>


    <script>

    /* Code below to replace the cspa's with the actual html -- woaah it works well */    
        function ReplaceCustomTags() {
            // cspa is a random term-- doesn;t mean anything really
            var grs = $("*"); 
            $.each(grs, function(index, value) {
                var tg = value.tagName.toLowerCase();
                if(tg.indexOf("c-")==0) {
                    console.log(index);
                    console.log(value);
                    var obj = $(value);
                    var newhtml;
                    if(tg=="c-textfield") {
                        newhtml= '<input type="text" value="'+obj.attr('name')+'"></input>';
                    } else if(tg=="c-namefield") {
                        newhtml= '<input type="text" value="FirstName"></input><input type="text" value="LastName"></input>';
                    } else if(tg=="c-textarea") {
                        newhtml= '<textarea cols="20" rows="3">Some description from model</textarea>';
                    }
                    obj.context.outerHTML = newhtml;
                }


                z = obj;
            });
        }

        if(typeof(console)=='undefined' || console==null) { console={}; console.log=function(){}}

        $(document).ready(ReplaceCustomTags);
    </script>
    </html>


Update to the question:

Let me explain a bit further on this. Please assume that JavaScript is enabled on the browser – i.e application is not supposed to run without javascript.

I have seen libraries that use custom attributes to define custom behavior in specified tags. For example Angular.js heavily uses custom attributes. (It also has examples on custom-tags). Although my question is not from a technical strategy perspective – I fail to understand why it would strategically cause problems in scalability/maintainability of the code.

Per me code like <ns:contact …..> is more readable than something like <div custom_type=”contact” ….> . The only difference is that custom tags are ignored and not rendered, while the div type gets rendered by the browser

Angular.js does show a custom-tag example (pane/tab). In my example above I am using outerHTML to replace these custom tags – whilst I donot see such code in the libraries – Am I doing something shortsighted and wrong by using outerHTML to replace custom-tags?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:42:24+00:00Added an answer on June 17, 2026 at 9:42 pm

    I can’t think of a reason why you’d want to do this.

    What would you think if you had to work on a project written by someone else who ignored all common practices and conventions? What would happen if they were no longer at the company to find out why they did something a certain way?

    The fact that you have to just go through with JavaScript to make it work at all should be a giant red flag. Unless you have a VERY good reason to, do yourself a favor and use the preexisting tags. Six months from now, are you going to remember why you did things that way?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright so i need to open a .txt file that will be created in
Alright, I am not completely sure that I worded the title right, but I
Alright, i need to make a string defined as rootString that looks like this:
Alright I created some custom classes for my project sourced from this tutorial ,
Alright, in my rootViewController, I am able to push another viewController that I defined
I am learning cakePHP, everything seems alright except that I am very confused of
Alright, so this is the exercise: Define a class named student, containing three grades
Ruby lets you define default values for hashes: h=Hash.new(['alright']) h['meh'] # => [alright] Assignment
Alright, I have some data that I need to assign an int type identifier
Alright so people were not understanding clearly my question, so I removed the url

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.