I have variable x that contains set of attributes.
var x = 'class="test test1 test2" id="xyz" style="color:red"';
How can i insert x to the <body> tag. so body looks like
<body class="test test1 test2" id="xyz" style="color:red">
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
you could create a temp element and att attributes to it and then append all of its attributes to the body:
demo: http://jsbin.com/udilib/edit#javascript,html,live
but if you can then make the class, id and style as an object instead of a string, will save some code for you.