find a location for property in a new city

Wednesday, 3 November 2010

Allow self closing tags in TinyMCE

I needed to make a tag self-close when using TinyMCE. It wouldn't allow it though, it kept opening them up again for me even after I edited them in HTML. How difficult can it be to add a tag to this allow self-closing tags list.

Answer: Not very. Even still though it took me a ridiculous amount of time to find out how to allow a new self closing tag. So I thought I'd share my discovery in case anyone else is struggling to find the answer.

I was trying to type in <source src="myVideo.m4v" /> but TinyMCE kept changing it to <source src="myVideo.m4v" ></source>.

Closed setting allows new self-closing tags

Turns out there is a little know closed setting you can set on tinyMCEs init method. I added my source tag to the list like so:
closed: /^(br|hr|input|meta|img|link|param|area|source)$/

Now any source tags are automatically self closing.

Notice I added a load more like img. The others are there by default in the core TinyMCE code so if I were to just put in source, the others (like img) would stop being self-closing. Not cool.

Follow britishdev on Twitter

9 comments:

  1. If you are interested in an essay Review. We can help you with essay writing, dissertation writing, and thesis writing services in UK.

    ReplyDelete
  2. How often do you have to come up with and write text? I ask because I really don't like to do it. I found a site where there are ready essays on various topics this site is called exclusive paper. I hope help you.

    ReplyDelete
  3. Mellow withdrawal manifestations can happen in as meager as hours after the last beverage or take days to start. Side effects can extend from tremors, queasiness and night sweats to increasingly serious things like seizures, spasms and mental trips. Narcotics and drugs like clonidine and beta blockers are regularly given to help facilitate the side effects as they deteriorate. Numerous substantial consumers need nearer oversight by a clinical expert during detox as withdrawal from liquor can cause climbs in their circulatory strain level and even passing.
    quotes for people fighting addictions
    drug rehab quotes

    ReplyDelete
  4. It's fantastic that you are getting ideas from this post as well as from our discussion made here.
    Augurs Technologies Germany GmbH

    ReplyDelete
  5. Excellent read, Positive site, where did u come up with the information on this posting? I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work,If anyone interested similar one's have a look here thanks.

    shih tzu puppies for sale near me
    buy puppy online
    fuhrerschein-kaufen-schweiz

    ReplyDelete