Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts

    Question Calling variable

    Hi

    I am using jquery UI autocomplete in one of my website. What I was looking for is if I could call a variable from the "ui.autocomplete" function's options array (which is at line #21) to "ui.menu" function (line #459)?


    For example, I add an extra variable "myClass":

    Code:
    $.widget( "ui.autocomplete", {
    	options: {
    		myClass: 'highlight',
    		appendTo: "body",
    		autoFocus: false,
    		delay: 300,
    		minLength: 1,
    		position: {
    			my: "left top",
    			at: "left bottom",
    			collision: "none"
    		},
    		source: null
    	},
    and I should be able to call that variable somewhere under the "ui.menu" function, like this:

    Code:
    $.widget("ui.menu", {
    	_create: function() {
    		var self = this;
    		this.element
    			.addClass("ui-menu ui-widget ui-widget-content ui-corner-all " + parent.options.myClass)
    			.attr({
    				role: "listbox",
    				"aria-activedescendant": "ui-active-menuitem"
    			})

    I tried doing this using the parent.options.myClass syntax but it did not help. Can someone please tell me how to achieve this?

    PFA attached .js file.


    Thanks
    Attached Files Attached Files


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •