开发者

hiding a previous input button

I have php code which executes a loop, inside which it generates the following:

echo "<input type=\"button\" event='$eventID' id=\"sendsomeone\" value=\"Send a family member\"/>";
echo "<span id='$eventID'></span>";

Later, I have javascript which follows:

$('input:button').click(function() {
   $(this).next("span").append('You clicked this button!'); 
}

This code works fine. But I want it to also hide the button (but not all the buttons on the page)

I've tried fooling with code like

$(this).parent("input").hide();

and $(this).prev("input").hide();

But I can't puzzle out how to make it wor开发者_JAVA百科k.


It looks like you're already in the buttons selector by using $('input:button'), so have you tried doing this?

$(this).hide();


You might also want to look at toggle which is helpful as it swill hide it if it's visible, and show it if it's not:

$(this).toggle();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜