Make button enable in html5 from imacro - html

The button gets disable after one click and to click again i have to refresh the page. This is the html code to the button
/*<button class="btn btn-large center-block btnvote vote" id="765" disabled="disabled">Vote for me</button>*/
I want to make the button enable by using imacro by deleting this disabled="disabled" and click again by using macro.
Can any one help?

using javascript you can remove the disabled property:
document.getElementById('765').disabled = false;
you may need to have a quick search on how to run javascript in imacro if you don't already know how to do this.

Related

HTML button event on click and release

I'm new on HTML and I need to understand some basic stuff for a project with the ESP01 wi-fi module. I would like to create a web page with a button and this one has to have a different behaviour according to if it is pressed or released.
I tried with this
<button onclick='location.href='/UP_ON'' onmouseup='location.href='/UP_OFF''>UP</button>
but it doesn't work.
try location.href
<button onclick='location.href=/?UP_ON' onmouseup='location.href=/?UP_OFF'>UP</button>

When I press back in the browser, why is a button now missing it's disabled attribute?

I go to a page. A particular button (let's call it button A) that allows the user to continue checking out is currently disabled (as it should be).
I click on another button that leads me to another page to input my address details. After I have done this, the disabled button on the previous will be enabled once I am sent back there.
However, instead of filling in my address details, I press the browser BACK button and return to the previous screen. Button A is no longer disabled. It doesn't even have a disabled attribute when I inspect via the browser. If I refresh the browser, button A is disabled again.
This is the code for the button, part of a simple_form_for
= f.button :button, "Continue to checkout options", class: "btn btn-primary btn-rounded shopping-methods-continue js-checkout-submit", disabled: #basket.requires_address?
#basket.requires_address? is not being called when I go BACK.
I have tried hardcoding disabled: "disabled" to see what would happen, but it still doesn't even have a disabled attribute after pressing BACK.
Is there a problem with the caching of this page?
I have dug around the project, in perticular the javascript side of things. js-checkout-submit is not affected by any code.
Any ideas anyone?
So, we solved the problem by using turbolinks.
We gave the button a new class of js-disable-button.
And then added these instructions at the bottom of the code (coffeescript):
$(document).on 'turbolinks:load', () ->
if "#{#basket.requires_address?}"
$('.js-disable-button').attr('disabled': 'disabled');
So basically, the #basket.requires_address? check is performed every time the page is loaded, even when pressing BACK. And the button is disabled if the check returns true.
This has provided a solution, however I never really figured out why the problem was occurring in the first place.

My html link only opens with open in new tab?

My code has been working fine before but since I added the onlick part, i can no longer access it on left click. I have to open it in new tab.
<a onclick="event.preventDefault(); window.parent.postMessage('link_url:'+this.href,'*');" href="?redirect=Pro" class="btn btn-accept display-5" target="_blank">I AGREE</a>
I cant remove that part since I need it otherwise my other redirect links from another php file wouldnt work. If i remove it, I cant redirect properly. Kindly asking for advice on how to fix this so I can open with left click or at least automatically open in new tab on left click. Thanks in advance.
Remove the event.preventDefault Function from your HTML line. Because,
This will prevent your events.
<a onclick="window.parent.postMessage('link_url:'+this.href,'*');" href="?redirect=Pro" class="btn btn-accept display-5" target="_blank">I AGREE</a>

Open URL in new browser tab when click on HTML button

I am designing a web site with CodeIgniter and I want to open some URL when user click on its buttons (URLs have to open in new tab).
I use this code and it works when you want to open URL in same tab, but I want the URL to open in a new tab. I don't want to use JavaScript function too.
<button type="button" onclick="location.href='http://google.com'">Google</button>
If you could change your button to be an anchor...
Google
Then you could add styling to your anchor... if this is even required.
Try something like this
<button type = "button" onclick = "location.href = window.open('link')"></button>

How to automatically enable a button

I have a button in a JSP which gets disabled after the first click. This is just to prevent multiple form submission at the same time. I want to enable the button once the form is submitted. My current logic keeps the button enabled and it seems like it bypass the disable property.
Without this.disabled = false button works perfectly fine by keeping the button disabled but I also want it to be enabled once the process is finished.
<input type="submit" class="esignReports" value="Export E-Sign Information" title="This function will provide you a 30 day download of all your eSign transactions." onclick="this.disabled=true;this.value='Please wait...';document.getElementById('viewIntegrationReport').submit();this.disabled = false">
Is there anyway to do it without JS
Thanks,
I think your button actually gets disabled but it gets re-enabled automatically because the submit is async, so you don't have enough time to see it's 'disabled' state. You could put console.log(this.state) before and after the submit() call to be sure.
There's no way to get a callback on submit() calls using plain Javascript (since it is supposed to send the info and reload the page). You'll need to use jQuery if you want to re-enable the button, using callbacks.