Search code examples
c#jqueryajaxasp.net-mvc-4razor

How to do I save and get @html.raw div HTML into database using jquery and get


I need to use a multiline text box for that I using classic div. I Used here @html.raw of .net Razor view. Now I need to get that parent div containing @html.raw in HTML format so save in DB using jquery ajax, and get that HTML from DB to bind to a controller.

I tried using $("#idofDiv").html() but it didn't work.

<div class="box-footer">
  <button type="button" id="btnSaveNotes" class="btn btn-primary pull-right">Submit</button>
</div>
$("#idofDiv").html();   

I need to get outer div HTML containing HTML.raw using jquery to pass it using ajax to save into DB. and get using c# to bind it to view.


Solution

  • I found a proper solution.

    This is my code for div :

    enter image description here

    enter image description here