@LisaRamos
function C() {
$('.clear').click(function() {
$('#inputSec').text('0');
input = "";
});
};
what's happening is you are setting the textfield to have zero and when you press buttons it adds the number to the string. You need to come up with a way to remove the zero if it's the first number and there is no decimal point.
.text()
and when I clear my calculator, nothing happens.
.text("")
which represents nothing.
.charAt()
. if the function returns true you should remove the zero, good luck
@idietmoran I'm trying to write
function C() {
$('.clear').click(function() {
$('#inputSec').text("");
input = "";
return [str.charAt()];
});
};
I'm not sure what to do with str.charAt()
.
davidweedmark sends brownie points to @idietmoran :sparkles: :thumbsup: :sparkles:
:star: 288 | @idietmoran | http://www.freecodecamp.com/idietmoran
entry.innerHTML = '0';
if(value == 'AC') {
entry.innerHTML = '';
decimalAdded = false;
@LisaRamos
function numToString(str) {
var change = Number(str);
var change = change.toString();
return change;
}
console.log(numToString("002"));
check this out
if(value == 'AC') {
entry.innerHTML = '0';
decimalAdded = false;
$('.clear').click(function() {
$('#inputSec').text("");
input = "";
return [str.charAt()];
.click()
function?
@LisaRamos
you have to use the function for it to work
$('.numBut').click(function() {
var input = $("#inputSec").text();
input += $(this).text();
$('#inputSec').text(numToString(input));
});
here, anytime you invoke a number and 0 is the first number it gets removed.
.text()
field
NaN
. Should I revert back?
button:active
pseudo-class which gives the button a 'pressed down' effect when clicked. My aim is to disable that, to get a style similar to flat buttons
@LisaRamos it's something like
input =+ $(this).text();
as the input and .text() are strings, but i'm not sure out clicking on a .op calls an operator
Number( numHere )
turns a string into a number, but I think your code is missing something as I don't see how you are calling operators in the code
@jberns @vbroskas Pre-scaling an image maynot always be desirable, because users tend to have varying screen sizes. It's best to store the images in the right proportions (eg. 16:9 for laptops, a portrait orientation for phones etc) and then load them accordingly.
Also, consider optimizing your image to reduce the size. Google "JPEG optimizer" etc. Some online tools do it.
vbroskas sends brownie points to @jberns and @pradeepce and @pradeepce :sparkles: :thumbsup: :sparkles:
:star: 242 | @pradeepce | http://www.freecodecamp.com/pradeepce
:star: 242 | @pradeepce | http://www.freecodecamp.com/pradeepce
:star: 283 | @jberns | http://www.freecodecamp.com/jberns
vbroskas sends brownie points to @pradeepce :sparkles: :thumbsup: :sparkles:
:warning: vbroskas already gave pradeepce points
andrparsons sends brownie points to @pradeepce :sparkles: :thumbsup: :sparkles:
:star: 244 | @pradeepce | http://www.freecodecamp.com/pradeepce
vbroskas sends brownie points to @pradeepce :sparkles: :thumbsup: :sparkles:
:warning: vbroskas already gave pradeepce points
@vbroskas I think the columns align left by default. If you specify a border for the columns, you might to able to see what's wrong. I usually have
div { border: 1px solid red; }
in my css to debug layout issues :)
vbroskas sends brownie points to @pradeepce :sparkles: :thumbsup: :sparkles:
:warning: vbroskas already gave pradeepce points
ealized i had array[]thing in wron bplace,but it's still giving me a diffrent err now
gameStr += colors.symbol[Math.floor(Math.random()*colors.length)];
gameStr
, out of function calls... look at what colors
is made of
new Mana("w", "http://www.freesound.org/data/previews/1/1859_345-lq.mp3");
?
$(this).attr('id')
?
symbol
from your object seems to be working fine
@JackEdwardLyons You should specify a value for each of the option
s in your <select>
. For example,
<select id="countId">
<option value="1">1</option>
<option value="2">2</option>
<!-- and so on -->
Or am I missing something?
@hallectj I'm pretty new to JS myself, but I think the following lines
var docText = document.getElementById("countId");
var docNum = Number(docText.options[docText.selectedIndex].value);
store the selected value from the dropdown in docNum
. And value
attributes for <option>
seem to be traditional, so... Take a look: https://developer.mozilla.org/en/docs/Web/HTML/Element/select
pradeepce sends brownie points to @hallectj :sparkles: :thumbsup: :sparkles:
:star: 285 | @hallectj | http://www.freecodecamp.com/hallectj
embed
?hey everyone, does anyone know why JS might not save the valuables assigned inside the function? to be clear, I have a following click event:
var quoteout="";
....
$('.btn').click(function() {
var quote = Math.floor(Math.random()*20);
quoteout=arr[quote];
$('.space').text(arr[quote]);
});
it works and the <p> with class "space" gets the new text, but quoteout is not assigned a new value! what can be the reason?
newsHTML += '<h4><a href=' + value.link + '>' + value.headline + '</a></h4>';
"<a href=" + "'" + value.link + "'" + ">" + value.headline + "</a>"
kokochris sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star: 453 | @kirbyedy | http://www.freecodecamp.com/kirbyedy
bonifacyj sends brownie points to @motass :sparkles: :thumbsup: :sparkles:
:star: 316 | @motass | http://www.freecodecamp.com/motass
tommygebru sends brownie points to @swoozeki :sparkles: :thumbsup: :sparkles:
:star: 284 | @swoozeki | http://www.freecodecamp.com/swoozeki
<ul>
to 0 achieve what you are wanting?
:star: 328 | @kme211 | http://www.freecodecamp.com/kme211
tommygebru sends brownie points to @kme211 :sparkles: :thumbsup: :sparkles:
tommygebru sends brownie points to @kme211 :sparkles: :thumbsup: :sparkles:
:warning: tommygebru already gave kme211 points
<h1>
, <h2>
, etc, you might notice that they look like regular text after the reset but it shouldn't do anything with flexbox, I don't think. It's mostly margins, padding, and font sizes. Here's an example of a reset: http://meyerweb.com/eric/tools/css/reset/
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
lennixm sends brownie points to @avanbox :sparkles: :thumbsup: :sparkles:
:star: 207 | @avanbox | http://www.freecodecamp.com/avanbox
function clearCur()
{
Calculator.display('0')
secNum="0";
}
freecodecamp319 sends brownie points to @jrroman :sparkles: :thumbsup: :sparkles:
:star: 263 | @jrroman | http://www.freecodecamp.com/jrroman
avanbox sends brownie points to @kme211 :sparkles: :thumbsup: :sparkles:
:star: 329 | @kme211 | http://www.freecodecamp.com/kme211
avanbox sends brownie points to @kme211 and @idietmoran :sparkles: :thumbsup: :sparkles:
:warning: avanbox already gave kme211 points
:star: 290 | @idietmoran | http://www.freecodecamp.com/idietmoran
I can't seem to get my facebook and youtube links to align right on my navbar. Any ideas?
navbar-right
class needs to be on a <ul>
element.
rtc31293 sends brownie points to @jondcoleman :sparkles: :thumbsup: :sparkles:
:star: 544 | @jondcoleman | http://www.freecodecamp.com/jondcoleman
@kme211 I tried wrapping my last to <li>s in <ul>s with that class, but I got this:
show the local weather
ninja-ml sends brownie points to @freecodecamp319 :sparkles: :thumbsup: :sparkles:
:star: 398 | @freecodecamp319 | http://www.freecodecamp.com/freecodecamp319
<ul>
is actually inside the Web Design <li>
dropdown so you're missing a couple of close tags.
leaguelism sends brownie points to @freecodecamp319 :sparkles: :thumbsup: :sparkles:
:star: 399 | @freecodecamp319 | http://www.freecodecamp.com/freecodecamp319
jeckstex sends brownie points to @freecodecamp319 and @clarkarnold :sparkles: :thumbsup: :sparkles:
:star: 411 | @clarkarnold | http://www.freecodecamp.com/clarkarnold
:star: 400 | @freecodecamp319 | http://www.freecodecamp.com/freecodecamp319
jeckstex sends brownie points to @cyb3rd :sparkles: :thumbsup: :sparkles:
:star: 179 | @cyb3rd | http://www.freecodecamp.com/cyb3rd
jrroman sends brownie points to @freecodecamp319 :sparkles: :thumbsup: :sparkles:
:star: 401 | @freecodecamp319 | http://www.freecodecamp.com/freecodecamp319
hey getting a weird error while trying to redo the quote generator challenge
the error:
Uncaught SyntaxError: Unexpected token :
the code
angular.module("DeveloperQuotes", [])
.controller("MainCtrl", ['$scope', '$http', function($scope, $http){
$scope.random = function(){
$http.jsonp('http://quotes.stormconsultancy.co.uk/random.json?callback=JSON_CALLBACK').success(function(data){
$scope.quote = json.parse(data);
});
};
}]);
blayman sends brownie points to @kme211 :sparkles: :thumbsup: :sparkles:
:star: 331 | @kme211 | http://www.freecodecamp.com/kme211
lewis65 sends brownie points to @kurzninja :sparkles: :thumbsup: :sparkles:
:star: 399 | @kurzninja | http://www.freecodecamp.com/kurzninja