0

First I have a row and a submit button on a table like this:

 <tr id="date">
      <td class="left" valign="top">
         <label>Some content: </label>
      </td>
      <td class="right">
          <? if ($akis_kademe == "ekle") { ?>
                <input type="submit" name="submit5"  class="btn" value="Tarih ekle" />
          <? } ?>
       </td>
  </tr>

And isset method...

if(isset($submit5)){
               ?>
    <tr id="ek_takvim">
          <td class="left" valign="top">        
          </td>
          <td class="right">   
          </td>
    </tr> 

 <?  }?>

Jquery function...

$(document).ready(function(){
    $("submit5").click(function(){
        $(ek_takvim).hide();
    });
});

All I wanna do that when I click the button I wanna add isset section on my table and also hide the button at the same time.

JimHawkins
  • 4,843
  • 8
  • 35
  • 55
FurkOk
  • 67
  • 10

2 Answers2

1

Try the following

<?php $takvimDisplay =  isset($submit5)?"block":"none"; ?>
<tr id="ek_takvim" style="display:<?php echo $takvimDisplay ?>">
      <td class="left" valign="top">        
      </td>
      <td class="right">   
      </td>
</tr> 

$(document).ready(function(){
    $("input[name=submit5]‌").click(function(){
        $("#ek_takvim").show();
        $(this).hide();
    });
});
Sagar
  • 259
  • 2
  • 3
  • 14
0

I assume you add the row ek_takvim right after the button row and hide them by css or onLoad-Event. Then this will do the rest of the work.

$(document).ready(function(){
    $("input[name=submit5]‌").click(function(){
        $("#ek_takvim").show();
        $(this).hide();
    });
});

I like this approach more:

HTML

<input type="submit" name="submit5" onclick="goodFunctionName()"  class="btn" value="Tarih ekle" />

JS

function goodFunctionName(){
    $("#ek_takvim").show();
    $("input[name=submit5]").hide();
}

JsFiddle: https://jsfiddle.net/c0f7bn96/

Talk to me: https://jsfiddle.net/c0f7bn96/#&togetherjs=5BxtqPPlE1

Marcus
  • 1,910
  • 2
  • 16
  • 27