javascript - Using Jquery to adjust text size -


I want to select the desired font size of the user, and it only increases the font size of # text. Now I tried some different things but nothing seemed to work. I just want to click the up or down arrows and whenever they click, they make it bigger than 1px. However, only a category of 10-80 would otherwise give an error.

I will post the code below for html and js.

Thanks

HTML / JS

 

Code> ** & Lt; Id = "font" & gt; & Lt; H2 & gt; Font size & lt; / H2 & gt; & Lt; Input type = "text" name = "font" value = "15" id = "font" /> Px & lt; Br / & gt; & Lt; Span id = "size warning" & gt; & Lt; / Span & gt; & Lt; / Select & gt; ** $ (document) .ready (function () {$ ('# buttonup'). Click (function () {curcize = parseInt ($ ('# text') .css ('font-size' ('font - $ ('font-size')); $ ('font-shape'); $ ('function') {cursize} = ParseInt ($ ('# text') - 2; If (cursize> = 12) $ ('# text'). CSS ('font-size', curceize);});}); A simple example was created (updated, some checked that the font- Size only 10- 80):

Demo:

JS:

  $ ("# up"). Click (function () { Var currentSize = $ ("current text"); CSS ("font- Size "); Current SICE = Current Seiz.Relest (/ [^ \ D.] / G," "); Current SIP ++; if (current SICF and LT; 10 || Current SEZ> 80) {Warning ("Font size between only 10 and 80!");} And {$ ("# text"). CSS ("font-size", "" + current size + "px");}}); $ ( "#down") (current) = "" ("font-size"); currentSize = currentSize.replace (/ [^ \ d.] / G, "" (Current size and lt; 10 || Current session & gt; 80) {Warning ("font sizes between only 10 and 80!");} And {$ ("# text"). CSS ("font size", "" + current size + "px");}}); $ ("Input # input sequence"). ("Keypack change", function () {var newSize = $ (this) .val (); if (new size & lt; 10 || newSize & gt; 80) {alert ("font size between only 10 and 80 ! ");} And {$ (" # text "). CSS (" font-size "," "+ new size +" px ");}});  

HTML:

  & lt; P id = "text" & gt; Lesson, yay! & Lt; / P & gt; & Lt; Span id = "up" & gt; Up & lt; / Span & gt; & Lt; Br / & gt; & Lt; Span id = "down" & gt; Down & lt; / Span & gt; & Lt; Br / & gt; Resize through input: & lt; Input id = "inputSize" type = "number" step = "1" value = "20" max = "80" min = "10" />  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -