Online JavaScript Link
Generate HTML links that run JavaScript on click (e.g. javascript: or onclick). Use for in-page actions—copy the snippet.
<a href="javascript:void(0)" onclick="alert('Hello');">Click me</a>Frequently Asked Questions
- When should I use a javascript: link?
- For simple in-page actions (e.g. toggle, scroll). Prefer <button> or proper event handlers for accessibility.
- Is javascript: URL safe?
- Avoid user-controlled input in the script. javascript: URLs can be blocked by CSP or cause security warnings.
- What about onclick?
- onclick on an <a href="#"> is an alternative. This tool can generate both patterns.
Related Developer Tools
JSON Formatter
Format, validate, and beautify JSON. Minify or pretty-print with one click.
Base64 Decode
Decode Base64 strings to text. Encode text to Base64.
UUID Generator
Generate random UUIDs (v4) for unique identifiers. Copy with one click.
URL Encoder Decoder
Encode and decode URLs. Convert special characters for safe use in URLs.
Convert Color Hex to RGB
Convert hex color codes to RGB values (R, G, B).
Convert Color RGB to Hex
Convert RGB values (R, G, B) to hex color codes.