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
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:
:cookie: 406 | @gothamknight |http://www.freecodecamp.com/gothamknight
piteto
@piteto
@rafaelmonroy can you use .text() instead of .html()?
iso
@iso1048
@rafaelmonroy no worries. /n is a line break, but it does not seem to work exactly as planned
korzo
@korzo
@finkbeca So to make your script work you need to replace line 14 with var item = document.getElementsByClassName("todolist")[0].value;
iso
@iso1048
@piteto did not even think of that.
piteto
@piteto
in js, we would just use textContent instead of innerHTML if we don't want the html
rafaelmonroy
@rafaelmonroy
@piteto yeah that works too, then there is no need for the replace. good one, thanks guys!
CamperBot
@camperbot
rafaelmonroy sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:warning: @piteto's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
piteto
@piteto
assume it's similar in jquery
Jorge
@flawedLogic506
@finkbeca try this: Example
@finkbeca if u open the console, you'll see whatever you enter in the text field
Colin
@finkbeca
@OrangeKulture Thanks, any way to display it on screen?
CamperBot
@camperbot
finkbeca sends brownie points to @orangekulture :sparkles: :thumbsup: :sparkles:
:cookie: 449 | @orangekulture |http://www.freecodecamp.com/orangekulture
Jorge
@flawedLogic506
@finkbeca yeah i just console logged it so you can see it .. from there, you can definitely do what you would like .. let me show you
Colin
@finkbeca
ok
Jorge
@flawedLogic506
@finkbeca try again
something like that .. i mean depends on what you wanna do and all, probably best to do appendChild
or something along those lines
Colin
@finkbeca
thanks
rafaelmonroy
@rafaelmonroy
@gothamknight @piteto do you guys know if it is possible to filter out the data coming in my GET request to only those that have length of 150 character or less ?
I was thinking about using a if else statement
Jorge
@flawedLogic506
@rafaelmonroy u cannot condition a response from the server .. not unless it accepts parameters in your call
rafaelmonroy
@rafaelmonroy
@OrangeKulture what do you mean by “not unless it accepts parameters in your call"
Jorge
@flawedLogic506
you can pass in certain parameters in your headers when making a call to an API ..
generally speaking tho, you cant just ask the server for some data and filter the incoming data. What you can do, is once you have the response, then mess with the data in whatever way u need
rafaelmonroy
@rafaelmonroy
can i pass the data into a vairable from the call?
@OrangeKulture
in the success function?