Advertisement
Guest User

Untitled

a guest
Mar 6th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. @foreach (var item in Model.Select((x, i) => new { Data = x, Index = i + 1 }))
  2. {
  3. <div class="cell"> <input type="checkbox" name="chkbox" class="a" onclick="checkbox1()" data-id="@item.ID" />
  4. </div>
  5. <div class="cell" id="edit2">@Html.DisplayFor(modelItem => item.ExhibEndDate)</div>
  6. <div class="cell" id="edit1">@Html.TextBox("Enddate", item.ExhibEndDate) </div>
  7.  
  8. function checkbox1() {
  9.  
  10. if ($('.a').is(':checked')) {
  11. $(this).document.getElementById('edit1').style.display = 'block';
  12. $(this).document.getElementById('edit2').style.display = 'none';
  13. }
  14. }
  15.  
  16. @foreach (var item in Model.Select((x, i) => new { Data = x, Index = i + 1 }))
  17. {
  18. <div class="cell"> <input type="checkbox" onclick="checkbox(@item.Index)" />
  19. </div>
  20. <div class="cell" id="edit-@item.Index">@Html.TextBox("Enddate", item.ExhibEndDate) </div>
  21.  
  22. function checkbox(index){
  23. $(this).document.getElementById('edit-' + index).style.display = 'none';
  24. }
  25.  
  26. <div class="row">
  27. <div class="cell"> <input type="checkbox" name="chkbox" class="a" onclick="checkbox1(this)" data-id="@item.ID" />
  28. </div>
  29. <div class="cell datePicker" id="edit2">@Html.DisplayFor(modelItem => item.ExhibEndDate)</div>
  30. <div class="cell dateTxt" id="edit1">@Html.TextBox("Enddate", item.ExhibEndDate) </div>
  31. </div>
  32.  
  33. function checkbox1(chkBox)
  34. {
  35. $('.datePicker').hide();
  36. $('.dateTxt').show();
  37. if ($(chkBox).is(':checked')) {
  38. $(chkBox).parents('.row').children('.datePicker').show();
  39. $(chkBox).parents('.row').children('.dateTxt').hide();
  40. }
  41. }
  42.  
  43. jQuery(function(){
  44. jQuery("input.a").click(function(){
  45. if(jQuery(this).is(':checked')){
  46. jQuery("#edit1").show();
  47. jQuery("#edit2").hide();
  48. // add more logic here
  49. } else {
  50. jQuery("#edit1").hide();
  51. jQuery("#edit2").show();
  52. // add more logic here
  53. }
  54. });
  55. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement