kahlil / ama Goto Github PK
View Code? Open in Web Editor NEWThis project forked from aviflombaum/ama
Ask me anything!
This project forked from aviflombaum/ama
Ask me anything!
Mine are:
Hello Kahlil,
I have a drop down and a textarea that should only appear if the value of the drop down is equal to a certain value. In my real application, the drop down will be generated dynamically. I was able to get it working the way I want, almost.
When the correct value is selected, the textarea appears but when I change the value, the textarea stays. How can I fix this?
Here's the codepen
https://codepen.io/isogunro/pen/KeRYww?editors=1011
Thanks for any help you can provide.
Hi Kahlil,
What is your current/preferred setup for front-end development - automation tools, tests & deployment?
Does it make a difference is it's a pet project/internal tool or if it something for a customer?
Hi,
Thanks for offering to help.
Could you please tell me why view.displayInventory();
method doesn't show anything?
Here's my code
var ticketSystem = {
buyers: [],
adultTickets: 6,
adultPrice: 22.50,
childTickets: 7,
childPrice: 12.50,
totalTickets: function(){
return this.adultTickets + this.childTickets;
},
totalPrice: function(){
return this.adultPrice + this.childPrice;
},
sellTickets: function(name, a, c){
console.log("name: "+name);
console.log("a: "+a);
console.log("c: "+c);
if ((a>0 && a<=this.adultTickets) && (c>0 && c<=this.childTickets)){
this.adultTickets = this.adultTickets - a;
this.childTickets = this.childTickets - c;
this.buyers.push({
buyerName: name,
totAdults: a,
totChildren: c
})
}else{
console.log("You ordered "+a+" adult tickets and "+c+" child tickets, but there are "+this.adultTickets+" adult tickets and "+this.childTickets+" children tickets left. Please change your purchase order.");
}
console.log("List of buyers: ");
this.buyers.forEach(function(buyer){
console.log("Name: ---"+buyer.buyerName);
console.log("Adult Tickets: "+buyer.totAdults);
console.log("Child Tickets: "+buyer.totChildren);
console.log("************************************************");
console.log("Tickets remaining: "+this.totalTickets());
console.log("************************************************");
},this);
},
reviewTicket: function(name){
for(var x=0; x<=this.buyers.length; x++){
if (this.buyers[x].buyerName === name){
alert(this.buyers[x]);
return this.buyers[x];
}
}
}
}
var handlers = {
sellTickets: function(name, a, c){
var buyer = document.getElementById("name");
var adult = document.getElementById("adult");
var child = document.getElementById("child");
var transaction = document.getElementById("buyT");
if (transaction.value === "Buy"){
alert(buyer.value + "-"+adult.value+"-"+child.value);
ticketSystem.sellTickets(buyer.value, adult.value, child.value);
}
}
}
var view = {
displayInventory: function(){
var ulTag = document.querySelector("#allSells");
console.log(ulTag);
console.log(ticketSystem.buyers);
ticketSystem.buyers.forEach(function(buyer){
console.log("HELLO "+buyer);
var buyers = document.createElement("li");
buyers.innerHTML = buyer.buyerName;
console.log(buyers);
ulTag.appendChild(buyers);
});
}
}
view.displayInventory();
Here's the code in glitch:
https://glitch.com/edit/#!/ubiquitous-sort
Thanks!
I wonder how you manage to keep balance of your job as a coder, as music manager/producer (think this is what you do, otherwise correct me?) and your private life.
Also, do you have goals regarding each job? Will you drop one at some point?
I read #2, and now I'm interested where you see yourself in 5 years and 10 years? What are your big, long term goals in life?
Hej,
I’m curious about how long you have been wearing bald head and what was the reason to decide to let ’em grow again 💇♂️
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.