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
Moustapha
@moustaflo

I am working on the Simon game and I still can't figure out why it starts to ring twice
my link is https://codepen.io/moustaflo/full/ayqYLX/

it could be my variable called len in the if function. That is the only suspicion I have. When I alter it, it definitely sounds different

Jorge
@flawedLogic506
@adamfaraj u can have fallback images, in any case, what is the piece of info you want the icon to be based on? description or main?
iso
@iso1048
@adamfaraj if you really want to do it, you could use the darksky api - they give a list of their 'main' weather descriptions, but then you would probably need to make another ajax call using a different service to get location data...
Colin
@finkbeca
Hey I am trying to create a new element with the value from input does anyone know what might be wrong with my js <body>
<div>
<div>
<ol id = "output"></ol>
</div>
<form>
<input class = 'todolist'>
<button class = "add" onclick = "tDList()"> Add</button>
    </form>
</div>

<script>
    function tDList() {
        var item = document.getElementsByClassName("todolist");
        var itemString = document.createTextNode(item);
        var newItem = document.createElement("li");
        newItem.appendChild(itemString);
        document.getElementById("output").appendChild(newItem);
    }


</script>
</body>
<body>
<div>
<div>
<ol id = "output"></ol>
</div>
<form>
<input class = 'todolist'>
<button class = "add" onclick = "tDList()"> Add</button>
</form>
</div>

<script>
function tDList() {
var item = document.getElementsByClassName("todolist");
var itemString = document.createTextNode(item);
var newItem = document.createElement("li");
newItem.appendChild(itemString);
document.getElementById("output").appendChild(newItem);
}


</script>
</body>
Im sorry I dont know why it is not loading correctly
Jorge
@flawedLogic506
your input needs to have a type
are u working on codepen?
rafaelmonroy
@rafaelmonroy
can anyone tell me why my tweet button tries to tweet out an object? when i console log it, it shows as an empty object :/
https://codepen.io/rafaelmonroy/pen/prKMXZ?editors=1111
Colin
@finkbeca
@OrangeKulture Nope, brackets. I added type = "text" and if is still not working Ill add it to codepen real fast.
korzo
@korzo
@finkbeca Because it submit form and refresh page
You have to add event listener and preventDefault on form submit
Colin
@finkbeca
Could you give an example? @korzo
I don't have much experience working with js
korzo
@korzo
@korzo or add type="button" to your <button>
default type for button is submit
iso
@iso1048
@rafaelmonroy var text = $('#quote-holder').html(); maybe
Colin
@finkbeca
@korzo so now when I load it in codepen it shows [object HTML Collection] but when i try this in a local host nothing happens
rafaelmonroy
@rafaelmonroy
@gothamknight that worked but it brings a long the <br> tags
korzo
@korzo
@finkbeca bacause you append HTML Node, not text
Jorge
@flawedLogic506
yeah i was gonna say that append looks a little bit off ..
why not use jquery?
iso
@iso1048
@rafaelmonroy that is because you have the <br> tag in the html of that div
rafaelmonroy
@rafaelmonroy
@gothamknight is it possible to filter them out?
Colin
@finkbeca
@korzo Could you explain?
@OrangeKulture I didn't know jquery would be of use
and I dont know jquery lol
Jorge
@flawedLogic506
yeah jquery would make it a lot easier
first off, what are you trying to do ?
korzo
@korzo
@finkbeca item is array of objects, not text
Jorge
@flawedLogic506
are you trying to type something, click add and have that added to a list? right
korzo
@korzo
@finkbeca you need item[0].value
Colin
@finkbeca
@OrangeKulture Yes
iso
@iso1048
@rafaelmonroy try this:
var text=$('#quote-holder').html();
text = text.replace('<br>','\n');
Colin
@finkbeca
@korzo Thank you korzo for trying to help but I think I need to take a step back
CamperBot
@camperbot
finkbeca sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 423 | @korzo |http://www.freecodecamp.com/korzo
korzo
@korzo
@finkbeca add console.dir(item); after
@finkbeca and you will understand
Colin
@finkbeca
@korzo but I dont understand what you are saying currently
iso
@iso1048
@rafaelmonroy
var text=$('#quote-holder').html().replace(/<br>/g,'\n');use that
Colin
@finkbeca
@finkbeca I understand you are telling me to add things but if I dont understand the why , it is no help. Thanks for the attempt to help I appreciate it , it is just not helping lol.
CamperBot
@camperbot
sorry finkbeca, you can't send brownie points to yourself! :sparkles: :sparkles:
korzo
@korzo
@finkbeca document.getElementsByClassName returns array
of objects
input elements (<input> ) is object in javascript
You can get what is written in input from value property
rafaelmonroy
@rafaelmonroy
@gothamknight thanks man! i replaced the br with “” instead of \n what is \n?
CamperBot
@camperbot
rafaelmonroy sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles: