It seems to be working. Can you see any problems with it? (apart from the extra text not being available should JS be off but that's how it is now anyway so there is no loss if js is off but enhancement if on.)

PaulOB
—
2013-08-27T15:42:22Z —
#4

Spoke too soon:)

If the options have an apostrophe in the text then it breaks the whole thing.

I need to exclude the apostrophe from messing up the routine. It's fine without it.:(

There is one other small problem in that the plugin is adding the text as a title attribute but is including the whole span text html inside the title attribute. There must be an option somewhere to remove the title but I can't see it yet.

Pullo
—
2013-08-27T17:09:25Z —
#5

Hi Paul,

If you replace your apostrophes with their HTML entity numbers, then it works.

which means that as we are using the formatSelection option to add a <span> to the results text, formatted will never be undefined, so the return value of the escapeMarkup function will always be inserted into the <div>'s title attribute and we don't have a chance to change this.

Which means that what you are seeing is a bug and if you upgrade to v3.4.2 then the problem will go away

As an aside, this means that no title attribute will be present on the <div> (which seems to be the desired behaviour).If it is important for you to have one, it shouldn't be too hard to add this via an onchange event listener. Just let me know.

HTH

PaulOB
—
2013-08-27T19:59:21Z —
#12

Thanks Pullo.

I'll download the new version and see if it fixes the issue (without causing any other issues)

I'll need to test it on the real page as there are loads of variations of those selects but hopefully it won't affect them.

Thanks for your help (and Chris) as I would never have worked my way through this one on my own.

Pullo
—
2013-08-27T20:11:40Z —
#13

Hi Paul,

I managed to get the full tool tips to show when you hover over the results.Here's a demo.

I did this by creating a wrapper div around the return value of our original format function:

Just in case you didn't see it, don't overlook my previous post (no.13), re. the title attribute (I notice that you didn't include it in your demo).

PaulOB
—
2013-08-27T20:35:01Z —
#16

Pullo said:

Hi Paul,

I managed to get the full tool tips to show when you hover over the results.Here's a demo.

I did this by creating a wrapper div around the return value of our original format function:

Many thanks.

I've copied your page locally for future reference but I may leave it without the tooltip for the time being as it is only duplicating what is already displayed so is not really any extra help. However if we need to truncate the text in the option at some point then it may need the tooltip added back in but at present we are letting the text wrap if needed but of course things may change