Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Marius Nicolae
@bytao7mao
i want to return only once, and same result, not concatenating the same result
Kaz Baig
@kbaig
So then you would want to build your html in the loop, and use the html method outside of the loop
alpox
@alpox
@bytao7mao For the country as example:
<div class = "col-xs-12 alert message2">
        Your country: <span class="country"></span>
   </div>
#country { font-weight: bold; }
$("#country").text(json.countries[11]['name']);
@bytao7mao And what @kbaig tells you :-)
Actually, i wonder what you want to achieve with the loop
Kaz Baig
@kbaig
Ultimately he's using the loop to build his html
Probably more performant also to just concat the html string in the loop and call jQuery once after the loop
alpox
@alpox
@kbaig I see that, but still, does he want to add all countries? Or just one random one? One cannot be sure when he says he doesn't want to append
Naaman Saif
@Naaman-Saif
I have made the barebones for the pomodoro Clock can somebody help me with the Script? How do I get the Timer?
Kaz Baig
@kbaig
@alpox I think he wants to add all countries but if he clicks again, the same thing doesn't get added to the preexisting para
Try clicking the button more than once
alpox
@alpox
@Forlenza setInterval - or setTimeout
@kbaig Ah may be
So then he would need an accumulator or do a .empty before the loop and then use .append @bytao7mao
Kaz Baig
@kbaig

@alpox yeah then he could just do

$('.message').empty();
$('.message2').empty();

as his first 2 lines in the getJSON callback

alpox
@alpox
jup
Kaz Baig
@kbaig
That's the quickest but pretty imperative way
Marius Nicolae
@bytao7mao
empty() when ?
after append ?
alpox
@alpox
@bytao7mao before the for loop
Kaz Baig
@kbaig
first 2 lines of the callback
@bytao7mao The best solution to be honest though would be to just have a boolean that your click callback checks for before making the getJSON call
That way, you don't have to keep making a new request every time the user clicks, just the first time
Marius Nicolae
@bytao7mao
The empty method seems allright, the other method , to keep just a statement and get rid of Loop ?
Kaz Baig
@kbaig
what
Marius Nicolae
@bytao7mao
oh, keep loop and make the boolean statement outside ?
Kaz Baig
@kbaig
let hasNotClicked = true;
$('.clickButton').click(function() {
  if (hasNotClicked) {
    hasNotClicked = false;
    // everything else you were doing
  }
});
@bytao7mao does that make sense
Marius Nicolae
@bytao7mao
yeah
Marius Nicolae
@bytao7mao
so, with what i replace that code now ?
homebrainbox
@homebrainbox

Hey, when I collapse my navbar and click on the "hamburger icon" or icon bars there's no dropdown menu appearing. Any advice?

<div class="container-fluid">
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="container-fluid">
            <div class="navbar-header">
             <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span> 
             </button>    
                <a class="navbar-brand" href="#">BRAND</a>
            </div>
          <div class="collapse navbar-collapse" id="myNavbar">
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">about</a></li>
                <li><a href="#">portfolio</a></li>
                <li><a href="#">contact</a></li>
            </ul>
          </div>      
        </div>
    </nav>
</div>
<div>

</div>

Link: https://codepen.io/homebrainbox/pen/aVwmoJ

Stephen James
@sjames1958gm
@homebrainbox I think you need jquery along with bootstrap js
See console error Uncaught Error: Bootstrap's JavaScript requires jQuery
Sorin Ruse
@sorinr
@homebrainbox do u have loaded also bootstrap.js?
@homebrainbox and as @sjames1958gm pointed out jquery
Matt
@DaftlyPunkish
Hi guys. Can anyone here help me with the tic tac toe came?
Tom
@moT01
whats the problem? @DaftlyPunkish
Matt
@DaftlyPunkish
I'm having trouble with my random selction function
function compPicker() {
var compChoice = options(Math.floor(Math.random() * 9));
console.log(compChoice);
}
options is an array variable
Tom
@moT01
use brackets to grab something from an array
Nazar
@IsaakNazar
help ease-in-out doesnt work properly, works only ease-in but not out
https://codepen.io/NazarIsaak/pen/rYwEjg
Tom
@moT01
options[0] = first spot
so try option[Math.random....
Matt
@DaftlyPunkish
Ah!
Thank you!
Nazar
@IsaakNazar
.links:hover {
  transition: background  .3s ease-in-out;
  background: rgba(0, 0, 0, 0.8);
}
Matt
@DaftlyPunkish
Now I'm getting "compChoice" is not a function
Here's my pen