40
votes
11answers
19k views

How can you find the height of text on an HTML canvas?

The spec has a context.measureText(text) function that will tell you how much width it would require to print that text, but I can't find a way to find out how tall it is. I know it's based on the ...
29
votes
14answers
22k views

JavaScript Scale Text to Fit in Fixed Div

In JavaScript/jQuery, how can I scale a varying-length line of text inside a fixed-width Div so that the one line always fits inside the Div (as one line)? Thanks.
27
votes
6answers
17k views

disable text highlighting on double click in jQuery

I have this jQuery toggle. It work fine. <ul> <li>Go to the store</li> <li>Pick up dinner</li> <li>Debug crash</li> <li>Take a ...
24
votes
4answers
24k views

Decode &amp; back to & in javascript

I have strings like var str = 'One &amp; two &amp; three'; rendered into HTML by the web server. I need to transform those strings into 'One & two & three' Currently, that's ...
16
votes
1answer
8k views

svg text element width

I'm working on some ecmascript/javascript for an svg file and need to get the width and height of a text element so I can resize a rectangle that surrounds it. In html I would be able to use the ...
14
votes
1answer
7k views

How to modify raphael text?

After instantiating Raphael text like so var t = paper.text(50, 50, "Raphaƫl\nkicks\nbutt!"); how do I go about then modifying that text? t.text = "test"; did not work for me.
13
votes
7answers
4k views

Webkit-based blurry/distorted text post-animation via translate3d

This issue appears to affect all WebKit-based browsers, including the iPhone. First some background. The site I'm working on uses a JavaScript-based 'slider' animation that is basically identical to ...
12
votes
5answers
8k views

Most elegant way to force a TEXTAREA element to line-wrap, *regardless* of whitespace

Html Textarea elements only wrap when they reach a space or tab character. This is fine, until the user types a looooooooooooooooooooooong enough word. I'm looking for a way to strictly enforce line ...
11
votes
3answers
2k views

efficient method to replace multiple words in text

Using JavaScript I need to efficiently remove ~10000 keywords from a ~100000 word document, of which ~1000 will be keywords. What approach would you suggest? Would a massive regular expression be ...
10
votes
2answers
5k views

Cut off text in a div if it exceeds set width?

On a website I am working on users can add a heading to a section of a page.A simple example: M11-001 - loss of container and goods from Manchester With some headings the content can be quite ...
10
votes
2answers
9k views

<input> text change events

Is there a library that can extract all text events from an <input type=text> (or contentEditable -- any one-line input field) element? In particular, I need to know whenever the text is ...
10
votes
4answers
3k views

Fix a character to text input box using javascript/jquery

I am looking for a way to 'fix' a dollar symbol $ to a text input box eg <input type="text" value="$" /> but make it not possible for the default value to be removed, so that whatever the user ...
9
votes
2answers
17k views

How to remove spaces from a string using JavaScript?

I'm using jquery and now I need to remove spaces in the string retrieved as a parameter (file name).. For instance: I have: '/var/www/site/Brand new document.docx' I would like to get: ...
9
votes
8answers
8k views

How to Make Canvas Text Selectable?

Any suggestion is highly appreciated.
8
votes
3answers
3k views

JQuery Animated Text

It is ridiculously hard to find easy/simple animated text. Like the "Implosion" on this website http://codecanyon.net/item/jquery-text-animation/full_screen_preview/233445 but I'd have to pay for it. ...

1 2 3 4 5 41
15 30 50 per page