Hello all!
I was wondering if you guys could provide some insight to an assingment I have, I would highly highly appreciate it...
I've got to provide JavaScript code which would make the following changes, not modify the code, but add to it...
At https://registration.ft.com/signup/register
I have to attach a tracking event to the form...
Tracking code is to be: var cfTrack = function(val) { alert("Tracked "+val) };
When the form gets submitted that function to be called should be...
cfTrack(103);
The form should still submit and validate correctly, and I've got to give code that I would use to track the track the submission of this form.
Could someone PLEASE take a look at it and provide me some insight? I barely know where to begin...
@SlouchingToast
the > sign is a child selector...say you have...
h3 > strong {
color: blue;
}
It will give all <strong> elements whose parent elements are <h3> the color of blue
slouchingtoast sends brownie points to @gbsimon87 :sparkles: :thumbsup: :sparkles:
:cookie: 278 | @gbsimon87 |http://www.freecodecamp.com/gbsimon87
1ucid sends brownie points to @harry97 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for harry97
harry97 sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 673 | @gregatgit |http://www.freecodecamp.com/gregatgit
$('#getit').click(function() {
var values = $("#searchfield").val();
console.log(values);
$.getJSON(...// and the rest
});
1ucid sends brownie points to @harry97 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for harry97
What am I doing wrong with this code? I cannot get the bg color or the bg image to appear...
.aboutpage{
background-color: grey;
background-image: url:("https://i.imgur.com/UYwpBpl.jpg")
}
I am referencing it in HTML via:
<div class="aboutpage">
<p>Hello, world</p>
</div>
background-image: url(https://i.imgur.com/UYwpBpl.jpg)
wendyr21 sends brownie points to @mrburks :sparkles: :thumbsup: :sparkles:
:cookie: 277 | @mrburks |http://www.freecodecamp.com/mrburks
@SlouchingToast <div class="aboutpage">
</div>
<p>Hello, world</p>
</div>
somerandom42 sends brownie points to @mrburks :sparkles: :thumbsup: :sparkles:
:cookie: 278 | @mrburks |http://www.freecodecamp.com/mrburks
<a class="twitter-share-button"
type="button"
id='myTweet'
href="https://twitter.com/share"
data-size="large"
data-url="http://codepen.io/GCrofut/pen/PzJkKm"
data-related="twitterapi,twitter"
data-hashtags="WWIIQuotes"
data-count='vertical'
data-text="CHANGE THIS">Tweet</a><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
@SomeRandom42
(
@mrburks thanks for the feed back, one question what is the best way to try and control placement of text? I want to try and have the "Billy May Tribute Page " above the image not beside it
mrburks sends brownie points to @somerandom42 :sparkles: :thumbsup: :sparkles:
:cookie: 121 | @somerandom42 |http://www.freecodecamp.com/somerandom42
<a class="twitter-share-button"
...
...
data-text="CHANGE THIS">
mrburks sends brownie points to @ronaldrdguez :sparkles: :thumbsup: :sparkles:
:cookie: 315 | @ronaldrdguez |http://www.freecodecamp.com/ronaldrdguez
Here's one way to do it: Replace the class="col-xs-3" from your div tag with id="demo"
Then add this in your CSS:
#demo {
margin-right: 20%;
margin-left: 20%;
}
'<a class="twitter-share-button"
...
...
data-text=“‘ + myfunc() + '”>'
owl-exterminator sends brownie points to @ronaldrdguez :sparkles: :thumbsup: :sparkles:
:cookie: 316 | @ronaldrdguez |http://www.freecodecamp.com/ronaldrdguez
csteingraber sends brownie points to @ronaldrdguez :sparkles: :thumbsup: :sparkles:
:cookie: 317 | @ronaldrdguez |http://www.freecodecamp.com/ronaldrdguez
csteingraber sends brownie points to @owl-exterminator :sparkles: :thumbsup: :sparkles:
:cookie: 292 | @owl-exterminator |http://www.freecodecamp.com/owl-exterminator
@ronaldrdguez That didn't actually work for me. I wrote a test function that returned a string and called it like this:
data-text="" + myFunc() + "">
But all I got was an empty string as a result.
on one line, then paste your code, then another
line
<a>
tag in JavaScript. Calling mQ()
from HTML won’t work since it doesn’t know its dealing with JS code. You can set the data-text
attribute. This works:var theButton = document.getElementById('myTweet');
theButton.setAttribute('data-text', ’tweet text goes here’);
owl-exterminator sends brownie points to @ronaldrdguez :sparkles: :thumbsup: :sparkles:
:warning: owl-exterminator already gave ronaldrdguez points
$.getJSON(request_url, function(data) {
alert(data[0]["content"]+data[0]["title"]);
$('#main_quote').append(data[0]["content"]);
});
someone good at css, plz explain me this,
http://codepen.io/buiphuking/pen/Mewwjp?editors=1100
.wrap-in{
position: relative;
top:12px;
}
why 12 is fit at center?
function palindrome(str) {
// Good luck!
var exp=/[a-z]|[0-9]/gi;
var arr=str.match(exp);
for(var i=0;i<arr.length/2;i++){
if(arr[i]!=arr[arr.length-i-1]){
return false;
}
}
return true;
}
palindrome("eye");//note:palindrome("A man, a plan, a canal. Panama") should return true.
i am stuck,could someone help me,what’s wrong with this code?
fox-tails sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1212 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
var users = ["ESL_SC2", "ESL_CSGO", "freecodecamp", "storbeck", "terakilobyte", "habathcx", "RobotCaleb", "thomasballinger", "noobs2ninjas", "beohoff", "brunofin", "comster404", "test_channel", "cretetion", "sheevergaming", "TR7K", "OgamingSC2", "monstercat", "pink_sparkles"];
$.ajax({
url: "http://ip-api.com/json",
success: function(data) {
$.ajax({
url: "http://api.openweathermap.org/data/2.5/weather?lat=" + data.lat + "&lon=" + data.lon + "&APPID=e48ee4aaa640e2c29127ac3ccddb675c",
success: function(data) {
}
});
}
});
lantare sends brownie points to @deadpool37 :sparkles: :thumbsup: :sparkles:
:cookie: 275 | @deadpool37 |http://www.freecodecamp.com/deadpool37
smariecode sends brownie points to @kirbyedy and @gauravtolani :sparkles: :thumbsup: :sparkles:
:cookie: 127 | @gauravtolani |http://www.freecodecamp.com/gauravtolani
:star2: 1213 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
gauravtolani sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1214 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
{
"coord": {
"lon": 0.78, "lat": 0.25
}
,
"weather":[ {
"id": 803, "main": "Clouds", "description": "broken clouds", "icon": "04d"
}
],
"base":"cmc stations",
"main": {
"temp": 296.934, "pressure": 1030.02, "humidity": 100, "temp_min": 296.934, "temp_max": 296.934, "sea_level": 1030.01, "grnd_level": 1030.02
}
,
"wind": {
"speed": 5.22, "deg": 191.003
}
,
"clouds": {
"all": 76
}
,
"dt":1468231605,
"sys": {
"message": 0.0047, "country": "YE", "sunrise": 1468216709, "sunset": 1468260392
}
,
"id":8282146,
"name":"Font Al-Da'da",
"cod":200
}
```js ⇦ Type 3 backticks and then press [shift + enter ⏎]
(type js or html or css)
<paste your code here>,
then press [shift + enter ⏎]
``` ⇦ Type 3 backticks, then press [enter ⏎]
This an inline `<paste code here>
` code formatting with a single backtick() at _start_ and _end_ around the
code`.
See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics
$(document).ready(function() {
/*
$('#searchBox').keyup(function(key) {
if (key.keyCode == 13 || key.which == 13) {
//$('#searchBtn').click();
getResults();
}
})
*/
$(document).keypress(function(event) {
if(event.which == 13) {
event.preventDefault();
$('#output').empty();
getResults();
};
});
$('#searchBtn').on('click', function() {
$('#output').empty();
getResults();
});
});
db001 sends brownie points to @doko85 :sparkles: :thumbsup: :sparkles:
:cookie: 409 | @doko85 |http://www.freecodecamp.com/doko85
marvokdolor sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1215 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
gitgenie sends brownie points to @spot1000 and @kirbyedy :sparkles: :thumbsup: :sparkles:
:cookie: 336 | @spot1000 |http://www.freecodecamp.com/spot1000
:star2: 1216 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
marvokdolor sends brownie points to @gitgenie :sparkles: :thumbsup: :sparkles:
:cookie: 280 | @gitgenie |http://www.freecodecamp.com/gitgenie
rizwanahmed19 sends brownie points to @gitgenie :sparkles: :thumbsup: :sparkles:
:cookie: 281 | @gitgenie |http://www.freecodecamp.com/gitgenie
nilsvoorkamp sends brownie points to @spot1000 :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @spot1000 |http://www.freecodecamp.com/spot1000
<a href="#" id="my_id">
...
</a>
nilsvoorkamp sends brownie points to @deadpool37 :sparkles: :thumbsup: :sparkles:
:cookie: 276 | @deadpool37 |http://www.freecodecamp.com/deadpool37
$(document).ready(function() {
$("#search").click(function(event) {
var $input = $("input");
var search = $input.val();
$.ajax({
type: 'POST',
url: 'https://en.wikipedia.org/w/api.php?action=opensearch&search=' + search + '&limit=10&exsentences=1&namespace=0&format=json',
dataType: 'jsonp',
success: function(data) {
for (var i = 0; data[1][i]!= null ; ++i) {
console.log(data[1][i] + data[2][i] + '\n'+data[3][i]);
var html = "<a href=\"" + data[3][i] + "\" target=\"_blank\"> <div id=\'"+i+"\'><strong><h2>" + data[1][i] + "</h2></strong><h3>" + data[2][i] + "</h3></div></a><br>";
$(html).prependTo("#r");
}
}
});
});
});
var $input = $(event.target).find('input'); //<------ just use $("input"); or give the <input> an id
deadpool37 sends brownie points to @wearenotgroot and @spot1000 :sparkles: :thumbsup: :sparkles:
:cookie: 339 | @spot1000 |http://www.freecodecamp.com/spot1000
:star2: 1210 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
$(document).ready(function(){
function getQuote(){
var quote =["Hello World","Abcd","asdasd"];
var author=["khanh","duy","bui"];
var back = ["yellow","pink","blue"];
var random = Math.floor(Math.random()*quote.length);
var randomQuote = quote[random];
var randomAuthor = author[random];
var randomBack = back[random];
$("body").css({"background-color":back[random],"transition":"background-color 0.6s ease-in-out"});
$(".quote").text(randomQuote);
$(".author").text(randomAuthor);
};
$(".btn").on("click",function(){
getQuote();
});
});
@Deadpool37 or
$(document).keypress(function(e) {
if(e.which == 13) {
alert('You pressed enter!');
}
});
btw 13 is the keycode for the enter key
khanh19934 sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star2: 1211 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
http://codepen.io/Iadetunji/full/AXQaaN/
can anyone help with insigth on this project
khanh19934 sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:warning: khanh19934 already gave wearenotgroot points
$("input").keypress.. instead of document
type: 'GET', //<-------- instead of POST
Hello. I'm working on the calculator project. I try to change the value of my textbook after pressing a button on the calculator, but in vain. Anyone can help me with this issue? Thank you!
:warning: deadpool37 already gave wearenotgroot points
deadpool37 sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
@Iadetunji if not try and study the result of the first api query by logging the result in the dev console
$.getJSON("http://ip-api.com/json", function(json1) {
console.log(json1);
});
the response from the api will be an object with a bunch of property but the ones you are after is lon and lat.
json1.lat //to access the value
json1.lon //to access the value
you can either store them in some variables or just append them correctly into the next api url
here is your original api url for openweather
original url: "https://api.openweathermap.org/data/2.5/weather?lat=json1.latitude&lon=json1.longitude&APPID=6949c3c3aab774e328f0072aee66d40d"
correct way to append the result from the variable to the url is
"http://api.openweathermap.org/data/2.5/weather?lat=" + json1.lat + "&lon=" + "json1.lon" + "&APPID=6949c3c3aab774e328f0072aee66d40d"
another thing about the openweather api is that the https connection is for paid version of the api-key, so you just have to settle for http instead.
Now dealing with the crossorigin issue that you'll get, you'll have to append
&callback=?
to your url so it will turn into jsonp
"http://api.openweathermap.org/data/2.5/weather?lat=" + json1.lat + "&lon=" + "json1.lon" + "&APPID=6949c3c3aab774e328f0072aee66d40d&callback=?"
i-liszt sends brownie points to @juwdohr :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @juwdohr |http://www.freecodecamp.com/juwdohr
item
parameter in https://www.freecodecamp.com/challenges/stand-in-line needs to be changed as number
. So it will be easier to understand. What do you think?
num
.
@Iadetunji putting them together will look like this(console.log to view the result in the dev console)
function gettingJSON() {
$.getJSON("http://ip-api.com/json", function(json1) {
console.log(json1);
$.getJSON("http://api.openweathermap.org/data/2.5/weather?lat="+json1.lat+"&lon="+json1.lon+"&APPID=6949c3c3aab774e328f0072aee66d40d&callback=?", function(json2) {
console.log(json2);
});
});
}
if you are not used to appending the url parameters that way you can add an object that contains the url parameters instead in the $.getJSON. like so!
function gettingJSON() {
$.getJSON("http://ip-api.com/json", function(json1) {
console.log(json1);
$.getJSON("http://api.openweathermap.org/data/2.5/weather?callback=?",
{
lat: json1.lat,
lon: json1.lon,
APPID:'6949c3c3aab774e328f0072aee66d40d'
}, function(json2) {
console.log(json2);
});
});
}
@NixonRichard You haven't imported the font from google. You need something like this:
<link href='https://fonts.googleapis.com/css?family=Cinzel+Decorative:700|Orbitron:700' rel='stylesheet' type='text/css'>
When you clik on your gear for HTML under Stuff for <head>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Cinzel+Decorative:700|Orbitron:700' rel='stylesheet' type='text/css'>
<h1 style="font-family:lobster">A WEATHER APP</h1>
</head>
</html>
{
"stream": null,
"_links": {
"self": "https://api.twitch.tv/kraken/streams/CinCinBear",
"channel": "https://api.twitch.tv/kraken/channels/CinCinBear"
}
}
var users = [
'OMGitsfirefoxx',
'Dinglederper',
'MissPetrai',
'CinCinBear',
'Lilchipmunk',
'LegendaryLea',
'DizzyKitten',
'Phinklestein',
'freecodecamp'
];
uniforlyff sends brownie points to @sjames1958gm and @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1787 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 447 | @sorinr |http://www.freecodecamp.com/sorinr
<html>
<head>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&lang=en" />
<h1 style="font-family:lobster">A WEATHER APP</h1>
</head>
</html>
const func = (str) => {
return Array.prototype.map.call(str.split(' '), (word) => {
return word[0].toUpperCase() + word.slice(1);
}).join(' ');
};
func('hello! is it me you looking for?'); // 'Hello! Is It Me You Looking For?'
<button type="button" class="btn btn-default navbar-btn">
<a href="#portfolio">Portfolio</a>
</button>
? instead just write <a class="btn btn-default blablabla" href="#portfolio">
$.getJSON(weatherURL, function(weatherInfo){
var iconID = weatherInfo.weather[0].id;
var imageURL = "wi wi-owm-" + iconID;
$("#icon p").html("<i class='" + imageURL + "'></i> ");
trip16661 sends brownie points to @danoso89 :sparkles: :thumbsup: :sparkles:
:cookie: 313 | @danoso89 |http://www.freecodecamp.com/danoso89
:cookie: 289 | @neotriz |http://www.freecodecamp.com/neotriz
stephepush sends brownie points to @neotriz :sparkles: :thumbsup: :sparkles:
wthomason sends brownie points to @jiteshpabla :sparkles: :thumbsup: :sparkles:
:cookie: 187 | @jiteshpabla |http://www.freecodecamp.com/jiteshpabla
:cookie: 121 | @twickster |http://www.freecodecamp.com/twickster
wthomason sends brownie points to @twickster :sparkles: :thumbsup: :sparkles:
col,md,4
is not a valid class name
jueke sends brownie points to @disjfa :sparkles: :thumbsup: :sparkles:
:cookie: 336 | @disjfa |http://www.freecodecamp.com/disjfa
disjfa sends brownie points to @twickster :sparkles: :thumbsup: :sparkles:
:cookie: 122 | @twickster |http://www.freecodecamp.com/twickster
twickster sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 448 | @sorinr |http://www.freecodecamp.com/sorinr
twickster sends brownie points to @dashdummy :sparkles: :thumbsup: :sparkles:
:cookie: 281 | @dashdummy |http://www.freecodecamp.com/dashdummy
jueke sends brownie points to @jiteshpabla :sparkles: :thumbsup: :sparkles:
:cookie: 188 | @jiteshpabla |http://www.freecodecamp.com/jiteshpabla
jiteshpabla sends brownie points to @trip16661 :sparkles: :thumbsup: :sparkles:
:cookie: 385 | @trip16661 |http://www.freecodecamp.com/trip16661
coffeebeanzz sends brownie points to @trip16661 :sparkles: :thumbsup: :sparkles:
:cookie: 386 | @trip16661 |http://www.freecodecamp.com/trip16661
.nav-pills{
padding-left: 10px;
padding-right: 10px;
position: fixed;
width: 100%;
font-size: 25px;
font-family: cursive;
margin-left: -20px;
margin-right: -20px;
background-color: black;
}
.nav-pills li a{
color: gray;
}
body{
background-color: white;
}
.pageOne{
background-image: url(http://pixelhub.me/pixelhub1/images/uploads/1385467739background_portfolio.jpg);
background-size: cover;
height: 850px;
margin-top: -70px;
margin-left: -15px;
margin-right: -15px;
}
.pageTwo{
background-color: white
background-size: cover;
height: 800px;
margin-left: -15px;
margin-right: -15px;
}
.pageThree{
background-color: gray;
background-size: cover;
height: 800px;
margin-left: -15px;
margin-right: -15px;
}
.pageFour{
background-color: white
background-size: cover;
height: 950px;
margin-left: -15px;
margin-right: -15px;
}
padding: 200px;
color: white;
}
font-size: 100px;
}
font-size: 35px;
}
color: black;
padding: 15px;
}
font-size: 100px;
}
font-size: 35px;
}
color: black;
padding: 15px;
}
font-size: 100px;
}
font-size: 35px;
}
color: black;
padding: 15px;
}
font-size: 100px;
}
font-size: 35px;
}
footer{
background-color: gray;
text-align: center;
font-size: 25px;
color: black;
}
```js ⇦ Type 3 backticks and then press [shift + enter ⏎]
(type js or html or css)
<paste your code here>,
then press [shift + enter ⏎]
``` ⇦ Type 3 backticks, then press [enter ⏎]
This an inline `<paste code here>
` code formatting with a single backtick() at _start_ and _end_ around the
code`.
See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics
pull-left
class. use text-left
if you want it left aligned. <h1 class="text-left">Portfolio </h1>
. Pictures will show up under the heading after you make that change.
.append()
instead of .html()
- you are overwriting the html with every loop of your $.each
pull-left
and pull-right
instead of text-left
or text-right
.
lukenetti3 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:cookie: 660 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
lukenetti3 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:warning: lukenetti3 already gave tylermoeller points
build a random quote machine
smallestCommons()
bonfire. What do u think guys? :smile: const range = (arr) => {
let list = [],
min = Math.min(...arr),
max = Math.max(...arr);
while(max >= min) {
list.push(min);
min++;
}
return list;
};
const gcd = (x, y) => {
return (x % y === 0) ? y : gcd(y, x%y);
};
const scm = (x, y) => {
return (x * y) / gcd(x, y);
};
const smallestCommons = (array) => {
let list = range(array);
return list.reduce((x, y) => scm(x, y));
};
smallestCommons([1, 13]); // returns 360360
schalow sends brownie points to @disjfa :sparkles: :thumbsup: :sparkles:
:cookie: 347 | @disjfa |http://www.freecodecamp.com/disjfa
onclick="javascript:function()"
javascript:function()
to the href
attribute
$(".btn").click(function(){
//some code
});
It does the same job
https://codepen.io/designbuildshipsoftware/pen/begJwJ/
. Your weather app runs without errors for me over HTTP.
designbuildshipsoftware sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:cookie: 661 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
twickster sends brownie points to @disjfa :sparkles: :thumbsup: :sparkles:
:cookie: 348 | @disjfa |http://www.freecodecamp.com/disjfa
mashadim sends brownie points to @twickster :sparkles: :thumbsup: :sparkles:
:cookie: 124 | @twickster |http://www.freecodecamp.com/twickster
for(var i = 0; i < data[1].length; i++)
{
$resultSec.append("<p>" + data[1][i] + ": " + data[2][i] + "</p>");
}
lukenetti3 sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star2: 1213 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
kingcyrus sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 674 | @gregatgit |http://www.freecodecamp.com/gregatgit
kingcyrus sends brownie points to @gbsimon87 :sparkles: :thumbsup: :sparkles:
:cookie: 280 | @gbsimon87 |http://www.freecodecamp.com/gbsimon87
const setProfile = (workM, breakM, id, name) => {
gregatgit sends brownie points to @trip16661 :sparkles: :thumbsup: :sparkles:
:cookie: 387 | @trip16661 |http://www.freecodecamp.com/trip16661
trip16661 sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 675 | @gregatgit |http://www.freecodecamp.com/gregatgit