how to change multiple divs with javascriptHow do JavaScript closures work?How to change an element's class with JavaScript?How do I remove a property from a JavaScript object?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I redirect to another webpage?How do I include a JavaScript file in another JavaScript file?What does “use strict” do in JavaScript, and what is the reasoning behind it?How to check whether a string contains a substring in JavaScript?Reference — What does this symbol mean in PHP?How do I remove a particular element from an array in JavaScript?
Why do old games use flashing as means of showing damage?
Shoes for commuting
If I have an accident, should I file a claim with my car insurance company?
Tiny image scraper for xkcd.com
How can I implement regular expressions on an embedded device?
To which airspace does the border of two adjacent airspaces belong to?
Why did Boris Johnson call for new elections?
Resizing attribute form in QGIS 3
Arduino I2C Wire.onReceive hangs after a few loops
Draw the ☣ (Biohazard Symbol)
How to find better food in airports
What are some countries where you can be imprisoned for reading or owning a Bible?
Finder/Terminal: Find files that contain less than 21 lines of text
Numerical minimum of a one-valued function
Bidirectional Dictionary
What's the difference between a share and a stock?
How do I delete cookies from a specific site?
When making yogurt, why doesn't bad bacteria grow as well?
Has Rey's new lightsaber been seen before in canon or legends?
A magician's sleight of hand
Would you recommend a keyboard for beginners with or without lights in keys for learning?
Do mortgage points get applied directly to the principal?
What would a biological creature need in order to see into the future?
'Hard work never hurt anyone' Why not 'hurts'?
how to change multiple divs with javascript
How do JavaScript closures work?How to change an element's class with JavaScript?How do I remove a property from a JavaScript object?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I redirect to another webpage?How do I include a JavaScript file in another JavaScript file?What does “use strict” do in JavaScript, and what is the reasoning behind it?How to check whether a string contains a substring in JavaScript?Reference — What does this symbol mean in PHP?How do I remove a particular element from an array in JavaScript?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
The Problem:
I am trying to create a sticker tab with html, php, css and javascript. The sticker tab shows successfully, but I am having problems switching between the tabs.
There is a screenshot below.... The first tab with the stickers show automatically,but on clicking another tab, it disappears. It doesn't change to the next tab... I'm tired
The Question:
How do I change multiple divs with javascript?
What I've Tried:
<a href="#" class="input-group-btn emo-comment dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" >
<span class="btn btn-file" style="padding:12px 0px 20px 0px; margin-left: -22px;"><i class="mhd mhd24 mhd-sticker-emoji" data-icon="sticker-emoji" onclick="document.getElementById('tab-1<?php echo $wo['story']['id'];?>')"></i></span>
</a>
<ul class="dropdown-menu pull-right">
<div class="pretty_emoticon<?php echo $wo["story"]["id"];?>">
<ul class="tabs">
<li class="tab-link current" data-tab="tab-1<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('boys'); ?>"></li>
<li class="tab-link" data-tab="tab-2<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('bear'); ?>"></li>
<li class="tab-link" data-tab="tab-3<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('domba'); ?>"></li>
<li class="tab-link" data-tab="tab-4<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('smiles'); ?>"></li>
<li class="tab-link" data-tab="tab-5<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('cute-girl'); ?>"></li>
<li class="tab-link" data-tab="tab-6<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('sweaty-girl'); ?>"></li>
<li class="tab-link" data-tab="tab-7<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('smile-emoticon'); ?>"></li>
</ul>
<div id="tab-1<?php echo $wo["story"]["id"];?>" class="tab-content current" id="buka_twemoji<?php echo $wo["story"]["id"];?>">
<?php foreach ($wo['boysstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-2<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['meongemoji'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-3<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['animalstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-4<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['reactionstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv53 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-5<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['womencute'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-6<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['girlcute'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-7<?php echo $wo["story"]["id"];?>" class="tab-content">
<h5>People & Smyle</h5>
<?php foreach ($wo['emotorang'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Symbol</h5>
<?php foreach ($wo['emotsimbol'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Food & Drink</h5>
<?php foreach ($wo['emotmakanan'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Nature & Animal</h5>
<?php foreach ($wo['emotnatural'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Activity</h5>
<?php foreach ($wo['emotaktivitas'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Places & Travel</h5>
<?php foreach ($wo['emottamasya'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
</div>
</div>
</ul>
<style>
.relevantext-align:center;text-decoration:none!important;text-align:center;font-size:15px;display:-webkit-box;position:relative;font-weight:600;margin:7px;
.pretty_emoticon<?php echo $wo["story"]["id"];?>width: 350px;margin: 0 auto;height:300px;overflow:auto;text-align:center;
ul.tabsmargin: 0px;padding: 0px;list-style: none;
ul.tabs liborder-bottom: 1px #ededed solid;background:none;display: inline-block;padding: 10px 9px;cursor: pointer;
ul.tabs li.currentbackground: #ededed;color: #222;
.tab-contentdisplay:none;padding: 15px;
.tab-content.currentdisplay: inherit;
</style>
<script>
$(document).ready(function()
$('ul.tabs li').click(function()
var tab_id = $(this).attr('data-tab');
$('ul.tabs li').removeClass('current');
$('.tab-content').removeClass('current');
$(this).addClass('current');
$("#"+tab_id).addClass('current');
)
)
$( "ul.tabs" ).click(function( event )
event.stopPropagation();
);
</script>
https://i.stack.imgur.com/792Z1.jpg
javascript php
add a comment |
The Problem:
I am trying to create a sticker tab with html, php, css and javascript. The sticker tab shows successfully, but I am having problems switching between the tabs.
There is a screenshot below.... The first tab with the stickers show automatically,but on clicking another tab, it disappears. It doesn't change to the next tab... I'm tired
The Question:
How do I change multiple divs with javascript?
What I've Tried:
<a href="#" class="input-group-btn emo-comment dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" >
<span class="btn btn-file" style="padding:12px 0px 20px 0px; margin-left: -22px;"><i class="mhd mhd24 mhd-sticker-emoji" data-icon="sticker-emoji" onclick="document.getElementById('tab-1<?php echo $wo['story']['id'];?>')"></i></span>
</a>
<ul class="dropdown-menu pull-right">
<div class="pretty_emoticon<?php echo $wo["story"]["id"];?>">
<ul class="tabs">
<li class="tab-link current" data-tab="tab-1<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('boys'); ?>"></li>
<li class="tab-link" data-tab="tab-2<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('bear'); ?>"></li>
<li class="tab-link" data-tab="tab-3<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('domba'); ?>"></li>
<li class="tab-link" data-tab="tab-4<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('smiles'); ?>"></li>
<li class="tab-link" data-tab="tab-5<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('cute-girl'); ?>"></li>
<li class="tab-link" data-tab="tab-6<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('sweaty-girl'); ?>"></li>
<li class="tab-link" data-tab="tab-7<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('smile-emoticon'); ?>"></li>
</ul>
<div id="tab-1<?php echo $wo["story"]["id"];?>" class="tab-content current" id="buka_twemoji<?php echo $wo["story"]["id"];?>">
<?php foreach ($wo['boysstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-2<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['meongemoji'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-3<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['animalstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-4<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['reactionstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv53 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-5<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['womencute'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-6<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['girlcute'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-7<?php echo $wo["story"]["id"];?>" class="tab-content">
<h5>People & Smyle</h5>
<?php foreach ($wo['emotorang'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Symbol</h5>
<?php foreach ($wo['emotsimbol'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Food & Drink</h5>
<?php foreach ($wo['emotmakanan'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Nature & Animal</h5>
<?php foreach ($wo['emotnatural'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Activity</h5>
<?php foreach ($wo['emotaktivitas'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Places & Travel</h5>
<?php foreach ($wo['emottamasya'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
</div>
</div>
</ul>
<style>
.relevantext-align:center;text-decoration:none!important;text-align:center;font-size:15px;display:-webkit-box;position:relative;font-weight:600;margin:7px;
.pretty_emoticon<?php echo $wo["story"]["id"];?>width: 350px;margin: 0 auto;height:300px;overflow:auto;text-align:center;
ul.tabsmargin: 0px;padding: 0px;list-style: none;
ul.tabs liborder-bottom: 1px #ededed solid;background:none;display: inline-block;padding: 10px 9px;cursor: pointer;
ul.tabs li.currentbackground: #ededed;color: #222;
.tab-contentdisplay:none;padding: 15px;
.tab-content.currentdisplay: inherit;
</style>
<script>
$(document).ready(function()
$('ul.tabs li').click(function()
var tab_id = $(this).attr('data-tab');
$('ul.tabs li').removeClass('current');
$('.tab-content').removeClass('current');
$(this).addClass('current');
$("#"+tab_id).addClass('current');
)
)
$( "ul.tabs" ).click(function( event )
event.stopPropagation();
);
</script>
https://i.stack.imgur.com/792Z1.jpg
javascript php
Reorganized phrasing. Unsure about the actual question, had to defer to the question used in title.
– Jeremy Harris
Mar 27 at 18:45
The thing is, its a sticker tab with categories.. I want to be able to switch the categories.. When one shows,thing other should hide .... Like that kind of thing
– user8521658
Mar 28 at 3:37
I've added an image to clarify it... Please help out
– user8521658
Mar 28 at 3:52
add a comment |
The Problem:
I am trying to create a sticker tab with html, php, css and javascript. The sticker tab shows successfully, but I am having problems switching between the tabs.
There is a screenshot below.... The first tab with the stickers show automatically,but on clicking another tab, it disappears. It doesn't change to the next tab... I'm tired
The Question:
How do I change multiple divs with javascript?
What I've Tried:
<a href="#" class="input-group-btn emo-comment dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" >
<span class="btn btn-file" style="padding:12px 0px 20px 0px; margin-left: -22px;"><i class="mhd mhd24 mhd-sticker-emoji" data-icon="sticker-emoji" onclick="document.getElementById('tab-1<?php echo $wo['story']['id'];?>')"></i></span>
</a>
<ul class="dropdown-menu pull-right">
<div class="pretty_emoticon<?php echo $wo["story"]["id"];?>">
<ul class="tabs">
<li class="tab-link current" data-tab="tab-1<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('boys'); ?>"></li>
<li class="tab-link" data-tab="tab-2<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('bear'); ?>"></li>
<li class="tab-link" data-tab="tab-3<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('domba'); ?>"></li>
<li class="tab-link" data-tab="tab-4<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('smiles'); ?>"></li>
<li class="tab-link" data-tab="tab-5<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('cute-girl'); ?>"></li>
<li class="tab-link" data-tab="tab-6<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('sweaty-girl'); ?>"></li>
<li class="tab-link" data-tab="tab-7<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('smile-emoticon'); ?>"></li>
</ul>
<div id="tab-1<?php echo $wo["story"]["id"];?>" class="tab-content current" id="buka_twemoji<?php echo $wo["story"]["id"];?>">
<?php foreach ($wo['boysstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-2<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['meongemoji'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-3<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['animalstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-4<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['reactionstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv53 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-5<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['womencute'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-6<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['girlcute'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-7<?php echo $wo["story"]["id"];?>" class="tab-content">
<h5>People & Smyle</h5>
<?php foreach ($wo['emotorang'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Symbol</h5>
<?php foreach ($wo['emotsimbol'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Food & Drink</h5>
<?php foreach ($wo['emotmakanan'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Nature & Animal</h5>
<?php foreach ($wo['emotnatural'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Activity</h5>
<?php foreach ($wo['emotaktivitas'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Places & Travel</h5>
<?php foreach ($wo['emottamasya'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
</div>
</div>
</ul>
<style>
.relevantext-align:center;text-decoration:none!important;text-align:center;font-size:15px;display:-webkit-box;position:relative;font-weight:600;margin:7px;
.pretty_emoticon<?php echo $wo["story"]["id"];?>width: 350px;margin: 0 auto;height:300px;overflow:auto;text-align:center;
ul.tabsmargin: 0px;padding: 0px;list-style: none;
ul.tabs liborder-bottom: 1px #ededed solid;background:none;display: inline-block;padding: 10px 9px;cursor: pointer;
ul.tabs li.currentbackground: #ededed;color: #222;
.tab-contentdisplay:none;padding: 15px;
.tab-content.currentdisplay: inherit;
</style>
<script>
$(document).ready(function()
$('ul.tabs li').click(function()
var tab_id = $(this).attr('data-tab');
$('ul.tabs li').removeClass('current');
$('.tab-content').removeClass('current');
$(this).addClass('current');
$("#"+tab_id).addClass('current');
)
)
$( "ul.tabs" ).click(function( event )
event.stopPropagation();
);
</script>
https://i.stack.imgur.com/792Z1.jpg
javascript php
The Problem:
I am trying to create a sticker tab with html, php, css and javascript. The sticker tab shows successfully, but I am having problems switching between the tabs.
There is a screenshot below.... The first tab with the stickers show automatically,but on clicking another tab, it disappears. It doesn't change to the next tab... I'm tired
The Question:
How do I change multiple divs with javascript?
What I've Tried:
<a href="#" class="input-group-btn emo-comment dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" >
<span class="btn btn-file" style="padding:12px 0px 20px 0px; margin-left: -22px;"><i class="mhd mhd24 mhd-sticker-emoji" data-icon="sticker-emoji" onclick="document.getElementById('tab-1<?php echo $wo['story']['id'];?>')"></i></span>
</a>
<ul class="dropdown-menu pull-right">
<div class="pretty_emoticon<?php echo $wo["story"]["id"];?>">
<ul class="tabs">
<li class="tab-link current" data-tab="tab-1<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('boys'); ?>"></li>
<li class="tab-link" data-tab="tab-2<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('bear'); ?>"></li>
<li class="tab-link" data-tab="tab-3<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('domba'); ?>"></li>
<li class="tab-link" data-tab="tab-4<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('smiles'); ?>"></li>
<li class="tab-link" data-tab="tab-5<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('cute-girl'); ?>"></li>
<li class="tab-link" data-tab="tab-6<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('sweaty-girl'); ?>"></li>
<li class="tab-link" data-tab="tab-7<?php echo $wo["story"]["id"];?>"><img class="svgbeloved" src="<?php echo Wo_GetSvg('smile-emoticon'); ?>"></li>
</ul>
<div id="tab-1<?php echo $wo["story"]["id"];?>" class="tab-content current" id="buka_twemoji<?php echo $wo["story"]["id"];?>">
<?php foreach ($wo['boysstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-2<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['meongemoji'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-3<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['animalstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-4<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['reactionstickers'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv53 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-5<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['womencute'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-6<?php echo $wo["story"]["id"];?>" class="tab-content">
<?php foreach ($wo['girlcute'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer bv75 bv bv-' . $name . '"></i></span>'; ?>
</div>
<div id="tab-7<?php echo $wo["story"]["id"];?>" class="tab-content">
<h5>People & Smyle</h5>
<?php foreach ($wo['emotorang'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Symbol</h5>
<?php foreach ($wo['emotsimbol'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Food & Drink</h5>
<?php foreach ($wo['emotmakanan'] as $code => $name) $code = $code; echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Nature & Animal</h5>
<?php foreach ($wo['emotnatural'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Activity</h5>
<?php foreach ($wo['emotaktivitas'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
<h5>Places & Travel</h5>
<?php foreach ($wo['emottamasya'] as $code => $name) $code = $code;echo '<span onclick="Wo_AddEmoToCommentInput(' . $wo["story"]["id"] . ', '' . $code . '');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; ?>
</div>
</div>
</ul>
<style>
.relevantext-align:center;text-decoration:none!important;text-align:center;font-size:15px;display:-webkit-box;position:relative;font-weight:600;margin:7px;
.pretty_emoticon<?php echo $wo["story"]["id"];?>width: 350px;margin: 0 auto;height:300px;overflow:auto;text-align:center;
ul.tabsmargin: 0px;padding: 0px;list-style: none;
ul.tabs liborder-bottom: 1px #ededed solid;background:none;display: inline-block;padding: 10px 9px;cursor: pointer;
ul.tabs li.currentbackground: #ededed;color: #222;
.tab-contentdisplay:none;padding: 15px;
.tab-content.currentdisplay: inherit;
</style>
<script>
$(document).ready(function()
$('ul.tabs li').click(function()
var tab_id = $(this).attr('data-tab');
$('ul.tabs li').removeClass('current');
$('.tab-content').removeClass('current');
$(this).addClass('current');
$("#"+tab_id).addClass('current');
)
)
$( "ul.tabs" ).click(function( event )
event.stopPropagation();
);
</script>
https://i.stack.imgur.com/792Z1.jpg
javascript php
javascript php
edited Mar 28 at 3:50
user8521658
asked Mar 27 at 17:32
user8521658user8521658
11 bronze badge
11 bronze badge
Reorganized phrasing. Unsure about the actual question, had to defer to the question used in title.
– Jeremy Harris
Mar 27 at 18:45
The thing is, its a sticker tab with categories.. I want to be able to switch the categories.. When one shows,thing other should hide .... Like that kind of thing
– user8521658
Mar 28 at 3:37
I've added an image to clarify it... Please help out
– user8521658
Mar 28 at 3:52
add a comment |
Reorganized phrasing. Unsure about the actual question, had to defer to the question used in title.
– Jeremy Harris
Mar 27 at 18:45
The thing is, its a sticker tab with categories.. I want to be able to switch the categories.. When one shows,thing other should hide .... Like that kind of thing
– user8521658
Mar 28 at 3:37
I've added an image to clarify it... Please help out
– user8521658
Mar 28 at 3:52
Reorganized phrasing. Unsure about the actual question, had to defer to the question used in title.
– Jeremy Harris
Mar 27 at 18:45
Reorganized phrasing. Unsure about the actual question, had to defer to the question used in title.
– Jeremy Harris
Mar 27 at 18:45
The thing is, its a sticker tab with categories.. I want to be able to switch the categories.. When one shows,thing other should hide .... Like that kind of thing
– user8521658
Mar 28 at 3:37
The thing is, its a sticker tab with categories.. I want to be able to switch the categories.. When one shows,thing other should hide .... Like that kind of thing
– user8521658
Mar 28 at 3:37
I've added an image to clarify it... Please help out
– user8521658
Mar 28 at 3:52
I've added an image to clarify it... Please help out
– user8521658
Mar 28 at 3:52
add a comment |
0
active
oldest
votes
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55383336%2fhow-to-change-multiple-divs-with-javascript%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55383336%2fhow-to-change-multiple-divs-with-javascript%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Reorganized phrasing. Unsure about the actual question, had to defer to the question used in title.
– Jeremy Harris
Mar 27 at 18:45
The thing is, its a sticker tab with categories.. I want to be able to switch the categories.. When one shows,thing other should hide .... Like that kind of thing
– user8521658
Mar 28 at 3:37
I've added an image to clarify it... Please help out
– user8521658
Mar 28 at 3:52