Anele Ngqandu

Anele Ngqandu

  • 1.3k
  • 430
  • 28.5k

Pass list from an onclick to jquery method

Mar 29 2023 5:37 AM

Hi All

I am trying to pass a c# list parameter using an onclick to a jquery method. It refuses to go to the method I am assuming its the  brackets [] that causes that and the string inside the list have slashes & other characters. A string inside the list might look like this; "*abc/def-"

Please assist

<input type="radio" class="btn-check" value="Maybe" name="ckhanswerA" id="chk" onclick="nextSlide(@Json.Serialize(@question))" />
function nextSlide(question) {
    debugger;
    var myList = JSON.parse(question);
   
}

 


Answers (2)