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
DarkxPunk
@DarkxPunk
How is everyone today?
Zebralight
@zebralight
I was looking to resize an element based on the background image and I was wondering if there is a better solution than the one proposed here: https://stackoverflow.com/questions/600743/how-to-get-div-height-to-auto-adjust-to-background-size
Dardan Demiri
@dardandmr
@alpox Right now I am not in Zurich, but after a month or so I will be there
Why are you from Zurich ?
@DarkxPunk Great
How about you CSS Master
?
James Moore
@James-N-M
hey guys
so
I made each card in my page have a on click event, and on click I want to select another element within that element
specifically the 2nd child and then grab the text in the second child and put it in another box somewhere
$(document).on('click', '.card-body', function(){
let element = this.children[1];
$("#coinSelected").text = element.text;
// $("#coinSelected").text = this.text;
});
$(document).on('click', '.card-body', function(){ let element = this.children[1]; $("#coinSelected").text = element.text; // $("#coinSelected").text = this.text; });
alpox
@alpox
@dardandmr Close. I study at the UZH in zurich (oerlikon). I live in andelfingen in direction of schaffhausen though.
DarkxPunk
@DarkxPunk
@dardandmr Surviving. Very slow work day/
Ken Haduch
@khaduch
@James-N-M - do you have a URL for this - like a codePen pen??
DarkxPunk
@DarkxPunk
I got a challenge for yall...
Ken Haduch
@khaduch
@James-N-M - one thing that you might have a problem with if you have multiple #coinSelected elements is that you cannot have multiple elements with the same ID.
DarkxPunk
@DarkxPunk
I am awful at grid, but can you take this: https://codepen.io/DarkxPunk/pen/eMEgqJ and convert it from flex to grid?
LydaTech
@lydatech
@DarkxPunk yoiur tab system breaks on resize. Grid is for 2d layout vs flex's 1d
DarkxPunk
@DarkxPunk
@lydatech You mean it wraps?
LydaTech
@lydatech
@DarkxPunk yeah tabs normally doesnt wrap
DarkxPunk
@DarkxPunk
@lydatech Yeah it is fine if they dont wrap
Ken Haduch
@khaduch

@James-N-M - well, I did a quick experiment that got something to work, it might be what you're after - I made some guesses. With just a couple tweaks to your code that you showed above, not really sure exactly what your HTML code looks like, but this:

$(document).on("click", ".card-body", function() {
  let element = this.children[1];
  let $coinSelect = $("#coinSelected");
  $coinSelect.text(element.innerText); // $("#coinSelected").text = this.text;
});

works in my test pen. I think that you might have just gotten a little confused in using jQuery and vanilla JS together?

Neil
@NNeil1
How do I hide Scroll bar in Firefox? Can't use Overflow: none; since that targets everything on my website. I have tried overflow-y: none but that didn't work either. I just need to hide the scroll bar while I edit my menu, as it's getting in the way
James Moore
@James-N-M
@khaduch Thanks for getting back to me ! i did some stuff and got it to do what i want for now ! thanks brother
CamperBot
@camperbot
james-n-m sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3837 | @khaduch |http://www.freecodecamp.org/khaduch
James Moore
@James-N-M
@khaduch it doesnt work on my production environment so ... gonna try your version after all ! lol thanks again <#
CamperBot
@camperbot
james-n-m sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
api offline
James Moore
@James-N-M
<3
Ken Haduch
@khaduch
@James-N-M - okay, give it a shot and if it doesn't work in your production environment, perhaps something else is going on... Like i said, I guessed at some things like the HTML structure that you might have, so I might not have gotten it close enough to what you were using...
Gulsvi
@gulsvi
@NNeil1 It's overflow-y: hidden;
James Moore
@James-N-M
@khaduch After a merge of development repository into a production, is it good practise to reset server?
James Moore
@James-N-M
$(document).on("click", ".card-body", function() { console.log("Heloo this is working"); let element = this.children[1]; let $coinSelect = $("#coinSelected"); $coinSelect.text(element.innerText); // $("#coinSelected").text = this.text; });
$(document).on("click", ".card-body", function() {
console.log("Heloo this is working");
let element = this.children[1];
let $coinSelect = $("#coinSelected");
$coinSelect.text(element.innerText); // $("#coinSelected").text = this.text;
});
anyone know why this is potentially not working in a production environemnt
Gulsvi
@gulsvi
```js
// enter your code here
```
@James-N-M What errors do you get in the debug console?
James Moore
@James-N-M
$(document).on("click", ".card-body", function() {
    console.log("Heloo this is working"); 
    let element = this.children[1];
    let $coinSelect = $("#coinSelected");
    $coinSelect.text(element.innerText); // $("#coinSelected").text = this.text;
  });
no errors sadly lol !
Gulsvi
@gulsvi
I think we may have to see the HTML too - or get a prototype in codepen to debug
James Moore
@James-N-M
it displays hello this is working in dvelopment
<div class="container">
    <div class="card-group">
        <div class="card">
            <div class="card-body" >
                <h5 class="card-title">Bitcoin</h5>
                <p class="card-text" id="bitcoin"></p>
                <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
            </div>
        </div>
        <div class="card">
            <div class="card-body">
                <h5 class="card-title">Ethereum</h5>
                <p class="card-text" id="ethereum">Value.</p>
                <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
            </div>
        </div>
        <div class="card">
            <div class="card-body">
                <h5 class="card-title">BitcoinCashInfo</h5>
                <p class="card-text" id="bitcoinch">Value</p>
                <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
            </div>
        </div>
        <div class="card">
            <div class="card-body">
                <h5 class="card-title">DashCoin</h5>
                <p class="card-text" id="dashcoin">Value</p>
                <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
            </div>
        </div>
        <div class="card">
            <div class="card-body">
                <h5 class="card-title">LiteCoin</h5>
                <p class="card-text" id="litecoin">Value</p>
                <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
            </div>
        </div>
</div>

    <form method="POST" action="/purchaseTotal">
        @csrf
        <div class="row justify-content-center">
            <div class="form-group col-md-8">
                <label for="customers">Customers</label>
                <select class="form-control" id="customers" name="customer">
                    <option value=""></option>
                    <option value="brady">Brady</option>
                    <option value="jim">Jim</option>
                </select>
            </div>
        </div>

        <div class="row justify-content-center">
            <div class="form-group col-md-8">
                <label for="coins">Coin Purchasing</label>
                <input type="text" id="coinSelected" class="form-control" value="Choose A Coin" name="coinSelected"> 
            </div>
        </div>

        <div class="row justify-content-center">
            <div class="form-group col-md-8">
                <label for="amount">Currency</label>
                <span class="input-group-addon">$</span>
                <input type="number" value="100" name="currency" min="0" step="0.00001" data-number-to-fixed="2" data-number-stepfactor="100" class="form-control currency" />
            </div>
        </div>

        <button type="submit" class="btn btn-primary">Calculate Total Owed</button>
    </form>
</div>
Gulsvi
@gulsvi
@James-N-M Use .val() for input fields, not .text()
$coinSelect.val(element.innerText);
Ken Haduch
@khaduch
Are you seeing the "Heloo this is working" at all? Or is that not working, either... Are you loading jquery.js in your code?
Gulsvi
@gulsvi
I'm not sure why you don't get the "hello this is working" in production though