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

  • 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, 2011 at 9:46
  • Have you tried conditional formatting on the cell to hide the content based upon another field selection? Jul 28, 2011 at 12:05

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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