I know that there are a lot of other questions of this type, but none of them gave me my answer. This is throwing no errors, and I cannot see any bug or syntax errors.
I am trying to make a google fonts picker (kind of) using jquery:
js:
$("#submit").click(function () {
var fontFamilyOrig = $("#font").val();
var prefix = "//fonts.googleapis.com/css?family=";
var fontFamily = fontFamilyOrig.split(' ').join('+');
fontFamily = prefix + fontFamily;
var fontSize = $("#font-size").val();
var displayText = $("#display-text").val();
var boldToggle = $("#bold");
var itToggle = $("#italic");
$("#font-link").attr('href', fontFamily);
$("#display").css({
'font-family': fontFamilyOrig,
'font-size': fontSize
}).text(displayText);
});
HTML:
<div>
<table><tr> <td>Type the name of the font (in full):</td> <td><input type="text" name="font" id="font"></td></tr>
<tr><td> Type your display text:</td> <td><input type="text" id="display-text"></td></tr>
<tr>
<td>Choose a font size:</td><td><input type="number" value="" id="font-size"></td></tr>
<tr>
<td>Other options:</td>
<td>
<label><input type="checkbox" id="bold">Bold</label>
<label><input type="checkbox" id="italic">Italic</label>
</td>
</tr>
<tr>
<td><input type="submit" value="Go" id="submit"></td>
</tr>
</table>
</div>
<div id="display">
</div>
<link id="font-link" rel="stylesheet" href="">
So what this does is display the text the user inputs in the user-specified font and font-size. But the font works, while the font-size does not. Why is only the font working, and not the font-size? FIDDLE