Bug Tracker

Opened 11 years ago

Closed 11 years ago

#4487 closed bug (invalid)

ASP.NET Integration with 2 dropdowns, taking the wrong dropdown's value.

Reported by: alexander Owned by:
Priority: major Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

I got a dropdown (<select>) in a MasterPage and a dropdown in a contentpage.

They both have differnet ID's, and since one is in a contentpage, it will also get the contentplaceholder's namespace added to its ID, so I'm 100% sure they both get different ID's.

I have a jquery function declared like this in the content page: $(document).ready(function() {

generateSprites(".nav-top", "current-", true, 300, "slide"); $(".lightbox").lightbox({ fitToScreen: true }); $(".lighttextbox").lightbox({ fitToScreen: true });

$("#<%=ddSize.ClientID %>").change(function() { var str = $("select option:selected").val(); $("#size").text(str); }) .change();

});

The problem is, when the dropdown in the masterpage has options in it, this script will take the masterpage's dropdown value instead of the one in the content page, which is named ddSize.

When I dont put options in the masterpage's dropdown, it will work just fine.

Change History (2)

comment:1 Changed 11 years ago by alexander

Right, forgot to write. While using ordinary javascript and it works fine.

<select id="ddSize" onchange="SetSize(this);">

function SetSize(dropdown) {

var sp = document.getElementById('size');

sp.innerHTML = dropdown.value;

}

comment:2 Changed 11 years ago by dmethvin

Resolution: invalid
Status: newclosed

$("#<%=ddSize.ClientID %>").change( ... )

Most likely the ClientID isn't what you think it is. This seems unlikely to be a jQuery bug, but if you can attach a simple test case that reproduces the problem (one that doesn't require ASPX) then reopen the ticket.

Note: See TracTickets for help on using tickets.