使用javascript隐藏控件 [英] Hide controls using javascript

查看:63
本文介绍了使用javascript隐藏控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在做一个HTML页面,在该页面上,我需要删除另一个按钮单击上的某些控件的单击外观.


当我单击这些按钮中的任何一个时,我有5个编辑按钮,我想删除其余按钮的"onclick"属性.请帮助我!

Hi,

I am doing a HTML page where i need to remove the click attibute of some controls on another button click.


I have 5 edit buttons when i click anyone of these buttons i want to remove the "onclick" attribute of the rest. Please help me !

推荐答案

写入所有按钮单击事件
Write in all button click event
document.getElementsByName("myButton")[0].disabled = true;


其中muButton是按钮ID.
对于按钮1,如果您单击按钮1则其余按钮将被禁用,请为休息4按钮写上一行.


Where muButton is the button id.
For button 1 write the above line for rest 4 button than if u click button 1 than rest buttons will disabled.


Elsalmo 3alikom wa ra7mt ALLAH,

亲爱的,

如果您使用HTML按钮,
给所有Button相同的类,
Elsalmo 3alikom wa ra7mt ALLAH,

Dear,

If you work with HTML button then,
Give all Button same class,
<button class="edit" onclick="yourFunction();"></button>


那么您必须添加此功能


then you have to add this function

function yourFunction()
{


(' .edit').attr(' onclick'); }
('.edit').attr('onclick',null); }


此函数将使用class ="edit''
从所有按钮中删除所有onclick属性. 甚至您单击的按钮.

如果您不想删除触发按钮上的onclick,请告诉我,我们会为您处理.

最好的问候
艾哈迈德·阿萨夫(Ahmed Assaf)
电子商务开发人员


this function will remove all onclick attribute from all button with class=''edit''
even your clicked button.

if you want to don''t remove onclick from the trigger button, Let me know and I will handle this for you.

Best Regards
Ahmed Assaf
eBusiness Developer


这篇关于使用javascript隐藏控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆