admin管理员组文章数量:1026989
I have 2 elements, an anchor with onclick = "..." and an input with onfocus = "..." The anchor is toggled by the input button, so when the button is in focus, the anchor is displayed and when it loses focus the anchor is hidden. Is there a way I can access the onclick event from the anchor without the onblur occurring first?
input(type="radio", name="sample", value=str(sample['id']),
id="S"+str(sample['id']),onfocus = 'javascript:toggleVisibility("%stoggle");'
% sample['id'], onblur = 'toggleVisibility("%stoggle");' % sample['id'])
a("edit", id = "%stoggle" % str(sample['id']), style="display:none; float:right;
padding-left:10px; text-decoration:none;", href='do something')
I have 2 elements, an anchor with onclick = "..." and an input with onfocus = "..." The anchor is toggled by the input button, so when the button is in focus, the anchor is displayed and when it loses focus the anchor is hidden. Is there a way I can access the onclick event from the anchor without the onblur occurring first?
input(type="radio", name="sample", value=str(sample['id']),
id="S"+str(sample['id']),onfocus = 'javascript:toggleVisibility("%stoggle");'
% sample['id'], onblur = 'toggleVisibility("%stoggle");' % sample['id'])
a("edit", id = "%stoggle" % str(sample['id']), style="display:none; float:right;
padding-left:10px; text-decoration:none;", href='do something')
Share
Improve this question
asked Jul 10, 2012 at 7:20
atfergusatfergus
3204 silver badges18 bronze badges
3
- What do you mean by access? You want to fire onClick event or just get the function? And what do you need it for? There might me better solution... – Gatekeeper Commented Jul 10, 2012 at 7:25
- I'd just like to be able to change the value displayed with the radio button. As it is now, the href address or code won't execute because the onblur happens before the href fires. Is there a quick way I can just get that to happen? – atfergus Commented Jul 10, 2012 at 7:28
- Does it work now or still facing issues? – WolvDev Commented Jul 11, 2012 at 8:05
1 Answer
Reset to default 5Try to use the onmousedown
instead of onclick
.
I have 2 elements, an anchor with onclick = "..." and an input with onfocus = "..." The anchor is toggled by the input button, so when the button is in focus, the anchor is displayed and when it loses focus the anchor is hidden. Is there a way I can access the onclick event from the anchor without the onblur occurring first?
input(type="radio", name="sample", value=str(sample['id']),
id="S"+str(sample['id']),onfocus = 'javascript:toggleVisibility("%stoggle");'
% sample['id'], onblur = 'toggleVisibility("%stoggle");' % sample['id'])
a("edit", id = "%stoggle" % str(sample['id']), style="display:none; float:right;
padding-left:10px; text-decoration:none;", href='do something')
I have 2 elements, an anchor with onclick = "..." and an input with onfocus = "..." The anchor is toggled by the input button, so when the button is in focus, the anchor is displayed and when it loses focus the anchor is hidden. Is there a way I can access the onclick event from the anchor without the onblur occurring first?
input(type="radio", name="sample", value=str(sample['id']),
id="S"+str(sample['id']),onfocus = 'javascript:toggleVisibility("%stoggle");'
% sample['id'], onblur = 'toggleVisibility("%stoggle");' % sample['id'])
a("edit", id = "%stoggle" % str(sample['id']), style="display:none; float:right;
padding-left:10px; text-decoration:none;", href='do something')
Share
Improve this question
asked Jul 10, 2012 at 7:20
atfergusatfergus
3204 silver badges18 bronze badges
3
- What do you mean by access? You want to fire onClick event or just get the function? And what do you need it for? There might me better solution... – Gatekeeper Commented Jul 10, 2012 at 7:25
- I'd just like to be able to change the value displayed with the radio button. As it is now, the href address or code won't execute because the onblur happens before the href fires. Is there a quick way I can just get that to happen? – atfergus Commented Jul 10, 2012 at 7:28
- Does it work now or still facing issues? – WolvDev Commented Jul 11, 2012 at 8:05
1 Answer
Reset to default 5Try to use the onmousedown
instead of onclick
.
本文标签: javascriptHow to make onclick event occur before onblurStack Overflow
版权声明:本文标题:javascript - How to make onclick event occur before onblur? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745610840a2158994.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论