JSFiddle - React, Tailwind, and code Playground

by Christian Gambardella

HTML

<form action="#" method="post" id="richmessage">
    <textarea name="message" id="" cols="30" rows="10"></textarea>
    <div class="results"></div>
    <button type="submit">Abschicken</button>
</form>

CoffeeScript

# Reference jQuery
$ = jQuery

# Adds plugin object to jQuery
$.fn.extend
  # Change pluginName to your plugin's name.
  richMessage: (options) ->
    # Default settings
    settings =
      option1: true
      option2: false
      debug: true

    # Merge default settings with options.
    settings = $.extend settings, options

    # Simple logger.
    log = (msg) ->
      console?.log msg if settings.debug

    # _Insert magic here._
    return @each ()->
      log "Preparing magic show for #{@}"
      # You can use your settings in here now.
      log "Option 1 value: #{settings.option1}"
        

$('#richmessage-1').richMessage()