
Recent Posts:
- Previewing SVG in HTML-Kit
- Multiple browser modes on a single tab
- HTML-Kit Tools in German
- Wizards for creating HTML lists and tables
- File versioning and backup
Register to support HTML-Kit and get Tools
If you code in JavaScript, you can use your JavaScript skills in HTML-Kit Tools plugins to improve the way you use Tools.
Getting Started
Make sure that you’re using HTML-Kit Tools 20090411+.
First plugin in JavaScript
Here are the quick steps:
- Select "File > Insert > Add New Snippet" from HTML-Kit Tools main menu.
- Enter "My first JavaScript plugin" (or other title) in the "Title" field, and select "JavaScript" for the "Plugin Language."
- Type the following JavaScript code in to the "Snippet" field and click "OK" to close the snippet dialog.
var CurrTime = new Date(); HKit.Write( "Hello, world! It's "+ CurrTime.toString() );
To test your new snippet plugin, create a new document and select "File > Insert > My first JavaScript plugin" from the main menu.
Caret Action in JavaScript
Here’s how to manipulate selected text with a JavaScript plugin:
- Right click inside a document and select "Extra > Edit Caret Actions."
- Click "New" to create a new Caret Action.
- In "Short name" field enter "jscaretaction1″ (without quotes). Enter "My First JavaScript Caret Action" in "Title" field. Click "OK" to create the new Caret Action.
- Paste the following code inside newly created action:
#@begin-text "default" [plang="js"] var sSelText = HKit.GetSelText(); HKit.Write( sSelText.toUpperCase() ); #@end-text "default"
- Click "OK" to save changes.
To test the Caret Action, select some text in the current document and right click while pressing Ctrl key down. Select "My First JavaScript Caret Action" from the menu.