SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom list I built using SharePoint Designer. Its a multi view form so I'm updating in a batch with one SAVE button. Unfortunately I have a dropdown list on each row and I want to hide a textbox on the same row if the user selects a value e.g


  $("select[title='Status']").change(function () {

        var selectedValue = $("option:selected").val();
        if (selectedValue == 'Declined')

        alert('Please add a Reason');



The dropdown does fire but the problem is it works well for only the first dropdowns.Is it possible to loop through all the dropdown list and then when selected get the specific item of that list and then do something for a textbox on that row. Thanks in Advance

share|improve this question
What does your markup look like? The code you provided, should select all of the drop-down's on the page with a title attribute of Status. – iOnline247 Jul 28 '11 at 9:46
Have you tried conditional formatting on the cell to hide the content based upon another field selection? – Eric Alexander Jul 28 '11 at 12:05
up vote 1 down vote accepted

Looking at the code again, you have lost scope with your selectedValue variable. What you are looking to do is iterate through all of the drop downs and apply some logic to the one's that have a value of "Declined". To do that, you'll want to keep your variable assignments within scope of the current drop down. Your variable assignment should have the keyword $(this) within it. Here's an example:

var selectedValue = $(this).find("option:selected").text();

I've also changed the .val() call to .text(), because you are trying to compare the text if I'm not mistaken. It'd be nice to see some markup, but I believe this is why you aren't seeing any results.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.