JS Solution

Forums General discussion JS Solution

This topic contains 4 replies, has 2 voices, and was last updated by  Alexander Bautz 1 month ago.

  • Author
    Posts
  • #22430

    Kristina Amador
    Participant

    I am seeking a JS solution that will allow me to hide select (SPFieldChoice/radio button) options with JavaScript? (Cross browser). Please and thank you.

  • #22466

    Alexander Bautz
    Keymaster

    You can use something like this:

    // Hide option number 2 from the top (list is 0-indexed)
    jQuery("#dffs_ChoiceColumn2").find(".ms-RadioText:eq(1)").hide();
    // Show option number 2 from the top (list is 0-indexed)
    jQuery("#dffs_ChoiceColumn2").find(".ms-RadioText:eq(1)").show();

    Replace “ChoiceColumn2” with your fields internal name.

    Hope this gets you on track,
    Alexander

  • #22522

    Kristina Amador
    Participant

    Worked like a charm! Thank you so much Alex!

    -KMA

  • #22759

    Kristina Amador
    Participant

    Hi Alex, circling back on this topic. Might you be able to offer the same solution outcome for a SPFieldChoice/Multi-Choice column? Thank you in advance.

    -KMA

  • #22820

    Alexander Bautz
    Keymaster

    Hi Kristina,
    The same code for radio and checkbox (multichoice), but for a dropdown select you must use another approach. I have an example here but it needs a little modification to work in IE so scroll down and read my next comment as well.

    Alexander

You must be logged in to reply to this topic.