Two dynamic class added on same element at same time










0














In my bootstrap website I added fullpage.js, so when a dynamically one class want to add to the page. But two dynamic class added on same element at same time.
So it changed the functionality.



One class only add to the element.
I tried but didn't worked.
Can you please help me to solve this problem.



This is my code, in this code(fp-tableCell) class added two times



<section class="icon-section fp-section fp-table active" id="section-1">
<div class="fp-tableCell" style="height:600px;">
<div class="fp-tableCell" style="height:600px;">
<div class="container">
<div class="row">
<div class="col-md-9 col-sm-12 col-xs-12">
<img src="images/product-1.png" alt="img" class="max-width">
</div>
<div class="col-md-5 col-sm-12 col-xs-12 banner-txt">
<h3 class="preHeading"">volant</h3>
<h1 class="mainHeading">an icon for iconoclasts</h1>
<p class="description">Our singular purpose was to create a product not<br>
bound by convention.
Volant is the realization of that<br> dream.</p>
</div>
</div>
</div>
</div>
</div>
</section>









share|improve this question























  • Add your code please what you tried so far.
    – Hanif
    Nov 12 at 13:18










  • Thanks for your responce, i added my code. can you please help me.
    – Sankar S
    Nov 12 at 13:29










  • Can we see the code that is adding the elements?
    – Justin T.
    Nov 12 at 13:41










  • yeah..but i can't add here..it's too long code.
    – Sankar S
    Nov 12 at 13:44










  • I am just interested in the specific part that actually inserts the elements or adds the classes. But you can post to something like pastebin.com.
    – Justin T.
    Nov 12 at 13:45















0














In my bootstrap website I added fullpage.js, so when a dynamically one class want to add to the page. But two dynamic class added on same element at same time.
So it changed the functionality.



One class only add to the element.
I tried but didn't worked.
Can you please help me to solve this problem.



This is my code, in this code(fp-tableCell) class added two times



<section class="icon-section fp-section fp-table active" id="section-1">
<div class="fp-tableCell" style="height:600px;">
<div class="fp-tableCell" style="height:600px;">
<div class="container">
<div class="row">
<div class="col-md-9 col-sm-12 col-xs-12">
<img src="images/product-1.png" alt="img" class="max-width">
</div>
<div class="col-md-5 col-sm-12 col-xs-12 banner-txt">
<h3 class="preHeading"">volant</h3>
<h1 class="mainHeading">an icon for iconoclasts</h1>
<p class="description">Our singular purpose was to create a product not<br>
bound by convention.
Volant is the realization of that<br> dream.</p>
</div>
</div>
</div>
</div>
</div>
</section>









share|improve this question























  • Add your code please what you tried so far.
    – Hanif
    Nov 12 at 13:18










  • Thanks for your responce, i added my code. can you please help me.
    – Sankar S
    Nov 12 at 13:29










  • Can we see the code that is adding the elements?
    – Justin T.
    Nov 12 at 13:41










  • yeah..but i can't add here..it's too long code.
    – Sankar S
    Nov 12 at 13:44










  • I am just interested in the specific part that actually inserts the elements or adds the classes. But you can post to something like pastebin.com.
    – Justin T.
    Nov 12 at 13:45













0












0








0







In my bootstrap website I added fullpage.js, so when a dynamically one class want to add to the page. But two dynamic class added on same element at same time.
So it changed the functionality.



One class only add to the element.
I tried but didn't worked.
Can you please help me to solve this problem.



This is my code, in this code(fp-tableCell) class added two times



<section class="icon-section fp-section fp-table active" id="section-1">
<div class="fp-tableCell" style="height:600px;">
<div class="fp-tableCell" style="height:600px;">
<div class="container">
<div class="row">
<div class="col-md-9 col-sm-12 col-xs-12">
<img src="images/product-1.png" alt="img" class="max-width">
</div>
<div class="col-md-5 col-sm-12 col-xs-12 banner-txt">
<h3 class="preHeading"">volant</h3>
<h1 class="mainHeading">an icon for iconoclasts</h1>
<p class="description">Our singular purpose was to create a product not<br>
bound by convention.
Volant is the realization of that<br> dream.</p>
</div>
</div>
</div>
</div>
</div>
</section>









share|improve this question















In my bootstrap website I added fullpage.js, so when a dynamically one class want to add to the page. But two dynamic class added on same element at same time.
So it changed the functionality.



One class only add to the element.
I tried but didn't worked.
Can you please help me to solve this problem.



This is my code, in this code(fp-tableCell) class added two times



<section class="icon-section fp-section fp-table active" id="section-1">
<div class="fp-tableCell" style="height:600px;">
<div class="fp-tableCell" style="height:600px;">
<div class="container">
<div class="row">
<div class="col-md-9 col-sm-12 col-xs-12">
<img src="images/product-1.png" alt="img" class="max-width">
</div>
<div class="col-md-5 col-sm-12 col-xs-12 banner-txt">
<h3 class="preHeading"">volant</h3>
<h1 class="mainHeading">an icon for iconoclasts</h1>
<p class="description">Our singular purpose was to create a product not<br>
bound by convention.
Volant is the realization of that<br> dream.</p>
</div>
</div>
</div>
</div>
</div>
</section>






javascript html twitter-bootstrap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 14:12









GAURAV

6210




6210










asked Nov 12 at 13:16









Sankar S

96




96











  • Add your code please what you tried so far.
    – Hanif
    Nov 12 at 13:18










  • Thanks for your responce, i added my code. can you please help me.
    – Sankar S
    Nov 12 at 13:29










  • Can we see the code that is adding the elements?
    – Justin T.
    Nov 12 at 13:41










  • yeah..but i can't add here..it's too long code.
    – Sankar S
    Nov 12 at 13:44










  • I am just interested in the specific part that actually inserts the elements or adds the classes. But you can post to something like pastebin.com.
    – Justin T.
    Nov 12 at 13:45
















  • Add your code please what you tried so far.
    – Hanif
    Nov 12 at 13:18










  • Thanks for your responce, i added my code. can you please help me.
    – Sankar S
    Nov 12 at 13:29










  • Can we see the code that is adding the elements?
    – Justin T.
    Nov 12 at 13:41










  • yeah..but i can't add here..it's too long code.
    – Sankar S
    Nov 12 at 13:44










  • I am just interested in the specific part that actually inserts the elements or adds the classes. But you can post to something like pastebin.com.
    – Justin T.
    Nov 12 at 13:45















Add your code please what you tried so far.
– Hanif
Nov 12 at 13:18




Add your code please what you tried so far.
– Hanif
Nov 12 at 13:18












Thanks for your responce, i added my code. can you please help me.
– Sankar S
Nov 12 at 13:29




Thanks for your responce, i added my code. can you please help me.
– Sankar S
Nov 12 at 13:29












Can we see the code that is adding the elements?
– Justin T.
Nov 12 at 13:41




Can we see the code that is adding the elements?
– Justin T.
Nov 12 at 13:41












yeah..but i can't add here..it's too long code.
– Sankar S
Nov 12 at 13:44




yeah..but i can't add here..it's too long code.
– Sankar S
Nov 12 at 13:44












I am just interested in the specific part that actually inserts the elements or adds the classes. But you can post to something like pastebin.com.
– Justin T.
Nov 12 at 13:45




I am just interested in the specific part that actually inserts the elements or adds the classes. But you can post to something like pastebin.com.
– Justin T.
Nov 12 at 13:45












1 Answer
1






active

oldest

votes


















0














The code that generates the two <div> elements appears to have been minified and is therefore very difficult to interpret. I think the easiest way to solve this problem would be to remove the duplicate <div> elements from all of the <section> elements after the document has loaded. To do this, you can insert the following code just before your closing </body> tag:



<script>
var sectionElems = document.getElementsByTagName("section"); //creates an array containing all <section> elements
var outerDiv;
var innerDiv;

//loop through each <section> element found and remove duplicate <div> element
for(var i = 0; i < sectionElems.length; i++)
outerDiv = sectionElems[i].children[0];
innerDiv = outerDiv.children[0];
//check class names to make sure it is a duplicate element
if(outerDiv.className == innerDiv.className)
outerDiv.innerHTML = innerDiv.innerHTML;


</script>


This code loops through each <section> element and writes the content of the nested <div> element into the parent <div> element, basically overwriting itself without including the nested <div> element.






share|improve this answer






















  • I can able to saw the alert message, but that problem cant't be fixed..again the class add two times .@justin.T
    – Sankar S
    Nov 13 at 4:43











  • Sorry you're still having trouble with this. Would you mind posting the URL of the live site?
    – Justin T.
    Nov 13 at 13:03










  • Ok, I think I see the issue now. When I run it, I get the message and see that it has been successfully removed from the first <section>, but not the others. Since you only posted the <section> with id='section-1', I thought that was the only one that had the issue. I will update my solution shortly...
    – Justin T.
    Nov 13 at 13:25










  • I have updated my solution, this is working well on my end. Remember to paste the code just before your closing </body> tag at the bottom of your HTML document.
    – Justin T.
    Nov 13 at 13:42










  • yeah...its's working now...thank you so much for your help...@Justin T.
    – Sankar S
    Nov 14 at 5:45










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53262984%2ftwo-dynamic-class-added-on-same-element-at-same-time%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The code that generates the two <div> elements appears to have been minified and is therefore very difficult to interpret. I think the easiest way to solve this problem would be to remove the duplicate <div> elements from all of the <section> elements after the document has loaded. To do this, you can insert the following code just before your closing </body> tag:



<script>
var sectionElems = document.getElementsByTagName("section"); //creates an array containing all <section> elements
var outerDiv;
var innerDiv;

//loop through each <section> element found and remove duplicate <div> element
for(var i = 0; i < sectionElems.length; i++)
outerDiv = sectionElems[i].children[0];
innerDiv = outerDiv.children[0];
//check class names to make sure it is a duplicate element
if(outerDiv.className == innerDiv.className)
outerDiv.innerHTML = innerDiv.innerHTML;


</script>


This code loops through each <section> element and writes the content of the nested <div> element into the parent <div> element, basically overwriting itself without including the nested <div> element.






share|improve this answer






















  • I can able to saw the alert message, but that problem cant't be fixed..again the class add two times .@justin.T
    – Sankar S
    Nov 13 at 4:43











  • Sorry you're still having trouble with this. Would you mind posting the URL of the live site?
    – Justin T.
    Nov 13 at 13:03










  • Ok, I think I see the issue now. When I run it, I get the message and see that it has been successfully removed from the first <section>, but not the others. Since you only posted the <section> with id='section-1', I thought that was the only one that had the issue. I will update my solution shortly...
    – Justin T.
    Nov 13 at 13:25










  • I have updated my solution, this is working well on my end. Remember to paste the code just before your closing </body> tag at the bottom of your HTML document.
    – Justin T.
    Nov 13 at 13:42










  • yeah...its's working now...thank you so much for your help...@Justin T.
    – Sankar S
    Nov 14 at 5:45















0














The code that generates the two <div> elements appears to have been minified and is therefore very difficult to interpret. I think the easiest way to solve this problem would be to remove the duplicate <div> elements from all of the <section> elements after the document has loaded. To do this, you can insert the following code just before your closing </body> tag:



<script>
var sectionElems = document.getElementsByTagName("section"); //creates an array containing all <section> elements
var outerDiv;
var innerDiv;

//loop through each <section> element found and remove duplicate <div> element
for(var i = 0; i < sectionElems.length; i++)
outerDiv = sectionElems[i].children[0];
innerDiv = outerDiv.children[0];
//check class names to make sure it is a duplicate element
if(outerDiv.className == innerDiv.className)
outerDiv.innerHTML = innerDiv.innerHTML;


</script>


This code loops through each <section> element and writes the content of the nested <div> element into the parent <div> element, basically overwriting itself without including the nested <div> element.






share|improve this answer






















  • I can able to saw the alert message, but that problem cant't be fixed..again the class add two times .@justin.T
    – Sankar S
    Nov 13 at 4:43











  • Sorry you're still having trouble with this. Would you mind posting the URL of the live site?
    – Justin T.
    Nov 13 at 13:03










  • Ok, I think I see the issue now. When I run it, I get the message and see that it has been successfully removed from the first <section>, but not the others. Since you only posted the <section> with id='section-1', I thought that was the only one that had the issue. I will update my solution shortly...
    – Justin T.
    Nov 13 at 13:25










  • I have updated my solution, this is working well on my end. Remember to paste the code just before your closing </body> tag at the bottom of your HTML document.
    – Justin T.
    Nov 13 at 13:42










  • yeah...its's working now...thank you so much for your help...@Justin T.
    – Sankar S
    Nov 14 at 5:45













0












0








0






The code that generates the two <div> elements appears to have been minified and is therefore very difficult to interpret. I think the easiest way to solve this problem would be to remove the duplicate <div> elements from all of the <section> elements after the document has loaded. To do this, you can insert the following code just before your closing </body> tag:



<script>
var sectionElems = document.getElementsByTagName("section"); //creates an array containing all <section> elements
var outerDiv;
var innerDiv;

//loop through each <section> element found and remove duplicate <div> element
for(var i = 0; i < sectionElems.length; i++)
outerDiv = sectionElems[i].children[0];
innerDiv = outerDiv.children[0];
//check class names to make sure it is a duplicate element
if(outerDiv.className == innerDiv.className)
outerDiv.innerHTML = innerDiv.innerHTML;


</script>


This code loops through each <section> element and writes the content of the nested <div> element into the parent <div> element, basically overwriting itself without including the nested <div> element.






share|improve this answer














The code that generates the two <div> elements appears to have been minified and is therefore very difficult to interpret. I think the easiest way to solve this problem would be to remove the duplicate <div> elements from all of the <section> elements after the document has loaded. To do this, you can insert the following code just before your closing </body> tag:



<script>
var sectionElems = document.getElementsByTagName("section"); //creates an array containing all <section> elements
var outerDiv;
var innerDiv;

//loop through each <section> element found and remove duplicate <div> element
for(var i = 0; i < sectionElems.length; i++)
outerDiv = sectionElems[i].children[0];
innerDiv = outerDiv.children[0];
//check class names to make sure it is a duplicate element
if(outerDiv.className == innerDiv.className)
outerDiv.innerHTML = innerDiv.innerHTML;


</script>


This code loops through each <section> element and writes the content of the nested <div> element into the parent <div> element, basically overwriting itself without including the nested <div> element.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 13 at 13:40

























answered Nov 12 at 16:44









Justin T.

597313




597313











  • I can able to saw the alert message, but that problem cant't be fixed..again the class add two times .@justin.T
    – Sankar S
    Nov 13 at 4:43











  • Sorry you're still having trouble with this. Would you mind posting the URL of the live site?
    – Justin T.
    Nov 13 at 13:03










  • Ok, I think I see the issue now. When I run it, I get the message and see that it has been successfully removed from the first <section>, but not the others. Since you only posted the <section> with id='section-1', I thought that was the only one that had the issue. I will update my solution shortly...
    – Justin T.
    Nov 13 at 13:25










  • I have updated my solution, this is working well on my end. Remember to paste the code just before your closing </body> tag at the bottom of your HTML document.
    – Justin T.
    Nov 13 at 13:42










  • yeah...its's working now...thank you so much for your help...@Justin T.
    – Sankar S
    Nov 14 at 5:45
















  • I can able to saw the alert message, but that problem cant't be fixed..again the class add two times .@justin.T
    – Sankar S
    Nov 13 at 4:43











  • Sorry you're still having trouble with this. Would you mind posting the URL of the live site?
    – Justin T.
    Nov 13 at 13:03










  • Ok, I think I see the issue now. When I run it, I get the message and see that it has been successfully removed from the first <section>, but not the others. Since you only posted the <section> with id='section-1', I thought that was the only one that had the issue. I will update my solution shortly...
    – Justin T.
    Nov 13 at 13:25










  • I have updated my solution, this is working well on my end. Remember to paste the code just before your closing </body> tag at the bottom of your HTML document.
    – Justin T.
    Nov 13 at 13:42










  • yeah...its's working now...thank you so much for your help...@Justin T.
    – Sankar S
    Nov 14 at 5:45















I can able to saw the alert message, but that problem cant't be fixed..again the class add two times .@justin.T
– Sankar S
Nov 13 at 4:43





I can able to saw the alert message, but that problem cant't be fixed..again the class add two times .@justin.T
– Sankar S
Nov 13 at 4:43













Sorry you're still having trouble with this. Would you mind posting the URL of the live site?
– Justin T.
Nov 13 at 13:03




Sorry you're still having trouble with this. Would you mind posting the URL of the live site?
– Justin T.
Nov 13 at 13:03












Ok, I think I see the issue now. When I run it, I get the message and see that it has been successfully removed from the first <section>, but not the others. Since you only posted the <section> with id='section-1', I thought that was the only one that had the issue. I will update my solution shortly...
– Justin T.
Nov 13 at 13:25




Ok, I think I see the issue now. When I run it, I get the message and see that it has been successfully removed from the first <section>, but not the others. Since you only posted the <section> with id='section-1', I thought that was the only one that had the issue. I will update my solution shortly...
– Justin T.
Nov 13 at 13:25












I have updated my solution, this is working well on my end. Remember to paste the code just before your closing </body> tag at the bottom of your HTML document.
– Justin T.
Nov 13 at 13:42




I have updated my solution, this is working well on my end. Remember to paste the code just before your closing </body> tag at the bottom of your HTML document.
– Justin T.
Nov 13 at 13:42












yeah...its's working now...thank you so much for your help...@Justin T.
– Sankar S
Nov 14 at 5:45




yeah...its's working now...thank you so much for your help...@Justin T.
– Sankar S
Nov 14 at 5:45

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53262984%2ftwo-dynamic-class-added-on-same-element-at-same-time%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto