Web Design Forum: jquery plugin help - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

jquery plugin help need to manipulate a plugin, but I am failing

#1 User is offline   simon87ainley 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 27
  • Joined: 02-July 09
  • Reputation: 0
  • Gender:Male
  • Location:West Yorkshire, England
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 19 August 2010 - 10:22 AM

Hello there,

I am working on a project at the moment that requires some seriously skinned up select menus, I have managed to re-skin them but using this plugin however I have no way of determining what item has been selected from what select box as the plugin builds the same HTML every time it meets a select element in my HTML. I need some way of adding a unique identifier onto the end of a class, by manipulating the below plugin.

$.fn.customSelect = function() {
  // define defaults and override with options, if available
  // by extending the default settings, we don't modify the argument
	return this.each(function() {
		obj = $(this);  
		obj.after("<div class=\"selectoptions\"> </div>");
		obj.find('option').each(function(){ 
	  		$(".selectoptions").append("<div id=\"" + $(this).attr("value") + "\" class=\"selectitems\"><span>" + $(this).html() + "</span></div>");
		});
		obj.before("<input type=\"hidden\" value =\"\" name=\"" + this.name + "\" class=\"customselect\"/><div class=\"iconselect\">" + this.title + "</div><div class=\"iconselectholder\"> </div>")
	.remove();
		$('.iconselectholder').hide();
		$(".iconselect").click(function(){
			$(".iconselectholder").toggle("slow");});
			$(".iconselectholder").append( $(".selectoptions")[0] );
			$(".selectitems").mouseover(function(){
			$(this).addClass("hoverclass");
		});
		$(".selectitems").mouseout(function(){
			$(this).removeClass("hoverclass");
		});
		$(".selectitems").click(function(){
			$(".selectedclass").removeClass("selectedclass");
			$(this).addClass("selectedclass");
			var thisselection = $(this).html();
			$(".customselect").val(this.id);
			$(".iconselect").html(thisselection);
			$(".iconselectholder").toggle("slow")
		});
	});  
  // do the rest of the plugin, using url and settings
}




0

#2 User is offline   bocaj 

  • The First Messiah of Javology
  • PipPipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 3,383
  • Joined: 11-January 09
  • Reputation: 99
  • Gender:Male
  • Location:The West Country.
  • Experience:Web Guru
  • Area of Expertise:Entrepreneur

Posted 19 August 2010 - 03:17 PM

Have you got an example of the HTML before JavaScript, and then after?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users