Tuesday 15 July 2014

c# - Razor server side code block and Jquery -



c# - Razor server side code block and Jquery -

my application mvc5 c#, trying execute following:

@{ var s = model.physicalexam; if (s == null) { <script> alert("1"); $("#newsale1").hide(); </script> } else { <script> alert("2"); $("#newsale1").show(); </script> } }

alert works, not hide or show button. appreciate suggestions.

i guess newsale1 maybe isn't loaded in dom when script code executed. should set blocks within document ready event.

$( document ).ready(function() { console.log( "ready!" ); });

c# jquery asp.net-mvc razor

No comments:

Post a Comment