Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @foreach (var item in Model.Select((x, i) => new { Data = x, Index = i + 1 }))
- {
- <div class="cell"> <input type="checkbox" name="chkbox" class="a" onclick="checkbox1()" data-id="@item.ID" />
- </div>
- <div class="cell" id="edit2">@Html.DisplayFor(modelItem => item.ExhibEndDate)</div>
- <div class="cell" id="edit1">@Html.TextBox("Enddate", item.ExhibEndDate) </div>
- function checkbox1() {
- if ($('.a').is(':checked')) {
- $(this).document.getElementById('edit1').style.display = 'block';
- $(this).document.getElementById('edit2').style.display = 'none';
- }
- }
- @foreach (var item in Model.Select((x, i) => new { Data = x, Index = i + 1 }))
- {
- <div class="cell"> <input type="checkbox" onclick="checkbox(@item.Index)" />
- </div>
- <div class="cell" id="edit-@item.Index">@Html.TextBox("Enddate", item.ExhibEndDate) </div>
- function checkbox(index){
- $(this).document.getElementById('edit-' + index).style.display = 'none';
- }
- <div class="row">
- <div class="cell"> <input type="checkbox" name="chkbox" class="a" onclick="checkbox1(this)" data-id="@item.ID" />
- </div>
- <div class="cell datePicker" id="edit2">@Html.DisplayFor(modelItem => item.ExhibEndDate)</div>
- <div class="cell dateTxt" id="edit1">@Html.TextBox("Enddate", item.ExhibEndDate) </div>
- </div>
- function checkbox1(chkBox)
- {
- $('.datePicker').hide();
- $('.dateTxt').show();
- if ($(chkBox).is(':checked')) {
- $(chkBox).parents('.row').children('.datePicker').show();
- $(chkBox).parents('.row').children('.dateTxt').hide();
- }
- }
- jQuery(function(){
- jQuery("input.a").click(function(){
- if(jQuery(this).is(':checked')){
- jQuery("#edit1").show();
- jQuery("#edit2").hide();
- // add more logic here
- } else {
- jQuery("#edit1").hide();
- jQuery("#edit2").show();
- // add more logic here
- }
- });
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement