1.2.21 • Published 2 years ago

@frostsw/frostjs v1.2.21

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

FrostJS

A lightweight JS for basic DOM manipulation and more.

FrostJS Initialisation

You can initialise FrostJS using fr alias

You can have multiple fr(function(){ }); in a single script if necessary, but keep in mind that one of this instance will be enough. fr() functions, or any function, that is used to bind events must be called through this function, otherwise the browser will throw fr is undefined error.

<hr/>
<h4>Numbers Only</h4>
<input type ="text" id="txtText" value = "sample value"/><br/>
<pre>

fr("#txtText").typing(FrostJS.Typing.NUMBERS);

<hr/>
<h4>Titlecase</h4>
<textarea id="area">This is a text area</textarea><br/>
<pre>

fr("#area").typing(FrostJS.Typing.TITLECASE);

<hr/>
<h4>Binding an event</h4>
<p>You can bind an event to an element using .on() method. For list of DOM events, click <a href="https://www.w3schools.com/jsref/dom_obj_event.asp">here.</a></p>
<p class="mono">
    Syntax:<br/>
<mono>frObject.<b>on</b>("<b>event_name</b>", <i>callback</i>);</mono>
<br/><br/>
callback must be in a form of 
<i>
    <mono>anonymous function</mono>
</i> or an existing 
<i>
    <mono>function name</mono>
</i>.

// Using an existing function name: fr("#myBtn").on("blur", myFunction);

function myFunction(){ //code to trigger }

fr("#switch2").on("click", function (e) { fr("#switch2").class("active", "inactive"); fr("#switch1").class("inactive", "active"); });

1.2.21

2 years ago

1.2.18

2 years ago

1.2.19

2 years ago

1.2.20

2 years ago

1.2.12

2 years ago

1.2.16

2 years ago

1.2.17

2 years ago

1.2.14

2 years ago

1.2.15

2 years ago

1.2.11

2 years ago

1.2.10

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago