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
CamperBot
@camperbot
:star2: 8898 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
:cookie: 966 | @mot01 |http://www.freecodecamp.org/mot01
Kaz Baig
@kbaig
@Tezenn the right way to do it would be to just have an if/else statement based on which mode the user chooses
Tom
@moT01
@mbosnjak01 freecodecamp beta has some react exercises
it's not working :worried:
Matej Bošnjak
@mbosnjak01
@moT01 Yes, I might try them out, although I am completely fine with raw documentation as well :D
Marco Galizzi
@Tezenn
@kbaig yes i will follow the proper way ;)
Tom
@moT01
not quite sure what the problem is - the database for sure wont work yet - im looking
@1532j0004kg
dinesh
@1532j0004kg
ok tnx !
Tom
@moT01
there's a way to invite me to edit - click my little logo there and try and find it
dinesh
@1532j0004kg
:+1:
Stephen James
@sjames1958gm
@camperbot :+1:
maayoko
@maayoko
Hi, is anybody here doing server side rendering? How do you guys render css on server? How to extract wanted styles from css and inject them in html's style tag (I'm asking this because I'm using semantic-ui-css and there is a lot of css files)
VaseJS
@VaseJS
@maayoko you can’t render css on the server side. its a browser thing. you may produce code that is delieverd with css in place, but it thats not the same thing as rendering css on the server. to the server, css is just more code that it doesn’t know what to do with other than send it somewhere…the browser.
Aryan J
@AryanJ-NYC
@maayoko What are you using? I've done SSR.
iceveda06
@iceveda06
Its been awhile since i got brownie points
@maayoko for ex: if you have ruby on rails.. you would put your css and html into a specific folder so when user requests your files it will get served
Depending on the page
Hope that makes sense
baywatchbabe
@baywatchbabe
Hi guys :)
Matej Bošnjak
@mbosnjak01
not from denmark :P
supp
baywatchbabe
@baywatchbabe
Supp mate ;)
Anders Nicolai Magnussen
@andersnicolaimagnussen
var brukerTall = 0;
var numberArray = [];
var operator;
var temp = 0;
var resultString = "";
var evalString = 0;

// A $( document ).ready() block.


    $(function tall (tall) {
        brukerTall = tall;
        addToResult(brukerTall);
        updateViewResult(brukerTall);
    });

    $("#one").click(function() {

        alert("hello"
        );

        $(function addToResult(temp) {
            numberArray.push(temp);
        });

        $(function sjekkTall(tall) {

            addToResult(tall);
            var temp = 0;
            temp = tall;
            updateViewResult(tall)
        });

        $(function updateViewResult(temp) {

            $("#display").append(temp);
        });

        $(function operators(operator) {
            addToResult(operator);
            updateViewResult(operator);
        });

        $(function clearAll() {

            $("#display").text("");
        });

        $(function removeDigit() {

        });

        $(function fixString() {
            resultString = numberArray.toString();

            var valueFixed = resultString.replace(/,/g, '');

            calculate(valueFixed);
            //alert(valueFixed);

        });


        $(function fixString() {

            var resultaValue = parseFloat(eval(valueFixed));
            clearAll();
            updateViewResult(resultaValue);


        });

Can anyone see what is missing here?
Starting with jquery

```

its companing about missing a bracket somewhere. Can you spot it?
Dan Lafferty
@DanLaff
@nicolaimagnussen Add }) to the end. Your click function isn't closed.
Anders Nicolai Magnussen
@andersnicolaimagnussen
oh, so what I am doing know is having everyfunction inside the click function, that would be messy
var brukerTall = 0;
var numberArray = [];
var operator;
var temp = 0;
var resultString = "";
var evalString = 0;

// A $( document ).ready() block.


    $(function tall (tall) {
        brukerTall = tall;
        addToResult(brukerTall);
        updateViewResult(brukerTall);
    });

    $("#one").click(function() {

        alert("hello"
        );
    })

        $(function addToResult(temp) {
            numberArray.push(temp);
        });

        $(function sjekkTall(tall) {

            addToResult(tall);
            var temp = 0;
            temp = tall;
            updateViewResult(tall)
        });

        $(function updateViewResult(temp) {

            $("#display").append(temp);
        });

        $(function operators(operator) {
            addToResult(operator);
            updateViewResult(operator);
        });

        $(function clearAll() {

            $("#display").text("");
        });

        $(function removeDigit() {

        });

        $(function fixString() {
            resultString = numberArray.toString();

            var valueFixed = resultString.replace(/,/g, '');

            calculate(valueFixed);
            //alert(valueFixed);

        });


        $(function fixString() {

            var resultaValue = parseFloat(eval(valueFixed));
            clearAll();
            updateViewResult(resultaValue);


        });
is this the better way to do it, inside of onclick on the html button like this?
            <button onclick="tall(7)" value="7" class="btn btn-primary" id="seven">7</button>
I tried clicking on the button 1, but nothing is happening...
Dan Lafferty
@DanLaff
onclick attributes are usually not the better way to do it - keep javascript all together not a hybrid between your HTML/JS
Bjorn van de Peut
@bjorno43
@nicolaimagnussen Please use Codepen or Pastebin when posting large walls of code. It could be considdered spamming ;)
Mark Kubik
@KUBIX90

Hi

Can anyone help work out why the online/offline text method will not loop through like the rest of the code? Seems to only do the first channel

Thanks
Plus its not actually showing the text correctly either
Anders Nicolai Magnussen
@andersnicolaimagnussen

Okey, thanks. I will do that next time.
I know why the alert did not work, it was becuase the onclick was applied kind of after, so therefore the click event function did not have effect, okey thanks @DanLaff .

Do you always need document.ready function when using jquery?

Because everything was working fine without the functions looking like this

  $(function addToResult(temp) {
            numberArray.push(temp);
        });

but this did the job before,

function addToResult(temp) {
            numberArray.push(temp);
        }

So what is the difference, thanks in advance :)

CamperBot
@camperbot
nicolaimagnussen sends brownie points to @danlaff :sparkles: :thumbsup: :sparkles:
api offline
Dan Lafferty
@DanLaff
@nicolaimagnussen document.ready is deprecated in jQuery 3, but no, you don't always need it. If you have code that needs to wait for scripts to download first, for example, it can be necessary.
Rarely necessary though
I think if you're trying to alert the value of the button clicked, you can just give each button a class name like "digit" and do:
$('.digit').on('click', function() {
  alert($(this).val())
});
Dan Lafferty
@DanLaff
@KUBIX90 In HTML, the value of your ID attribute needs to be unique. Change id='status' in your JS to class='status' and modify your JS to use .status instead of #status
That will get the text showing up, but you'll still need to work out why it says "offline" for everyone
Anders Nicolai Magnussen
@andersnicolaimagnussen

so this would actually be considered better practice than having the btn on click on the HTML elements itself, that is intereseting.
And you are saying one of the reasons is because you want to have organised code, and keep the javascript /jquery seperated from the html.. .

Do you know why I cant access the function called tall from the click function here.

If you want an have time, I can share the code I had before with jquery and onclick, so maybe you can look over it and tell me the best way to implement what I want with Jquery?

Everything was working fine before, but the teacher has a test in python that checks for jquery and not just javascript as I have understood it.

Dan Lafferty
@DanLaff
@nicolaimagnussen Maybe you're trying to do this?
function functionOne() {

  function functionA() {
    // do something
  }

  function functionB() {
    // do something else
  }

  functionA(); // this will work fine
}

functionA(); // doesn't run because you can't call a function inside another function out here
From a quick look at your code - you may want to review Immediately Invoked Function Expressions (IIFE) and Function Scope in JavaScript. It's the same concept in jQuery, just slightly different syntax.
Mark Kubik
@KUBIX90
@DanLaff Thanks, got that bit working at least, my border shadow seems to work fine in showing the channels as offline/online, will have a look as to why its showing the same text throughout