0

Is it possible to use mulitple HTML div elements inside one JS object property (content in the example below):

$.Box({
                title : "Title",
                content : "<table id='1'></table>",
                "<table id='2'></table>"

            });

2 Answers 2

1

You would have to store them in an array .

Example 1 :

$.Box({
     title : "Title",
     content : ["<table id='1'></table>","<table id='2'></table>"]
  });

Example 2 :

 $.Box({
     title : "Title",
     content : function(){
        var format = ["<table id='1'></table>","<table id='2'></table>"];
        //do something to the format
       return format.join(" ");
      }()
  });

Hope this helps

Sign up to request clarification or add additional context in comments.

Comments

1

That isn't valid javascript for an object

Put all the html inside same quotes so it is all one string

$.Box({
       title : "Title",
       content : "<table id='1'></table><table id='2'></table>"
});

Or use a + to concatenate the string parts

$.Box({
       title : "Title",
       content : "<table id='1'></table>" + 
                 "<table id='2'></table>"
});

1 Comment

You can also use an array

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.