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
.