craigsworks.com - Support Forum

Full Version: Using the info in the qtip
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, first of all great job on the plugin, its awesome!
But i have a little question.

I want to use the info for a autocomplete, so that when its clicked to put the info in my input field.
JS Code
<script type="text/javascript">
		$(document).ready(function(){
 
			$('.tTip').qtip({
 
			   content: {
				  text: function(api) {
					 // Retrieve content from custom attribute of the $('.selector') elements.
					 return $(this).attr('title');
				  }
				  },
				  hide: {
					  event: 'unfocus'
				   }
				});
 
				$('ui-tooltip-content > span.clickable').click(function(){
				var text=$(this).text();
				$('input').val(text);
				});
		});
	</script>


HTML Code
<input type="text" class="autocoplete tTip" title="<span class='clickable'>ads</span>" />

but when i click the info nothing happends Sad can you give a hand?
Don't stick HTML inside the title attribute, use an ID'd element and pass that as the content via jQuery object instead. Also note that content functions are executed for every tooltip show! Don't use one if that's not what you intend or the content doesn't change regularly.
Thanks for this code i try to used this info...


_________________
datacenter
Reference URL's