Pressing "try it" button reloads the page - html

when I press a try it button at the bottom of my page, it reloads the page and deselects all checkboxes. THe main problem i have with this is that when i select a box and click total, the total will be displayed for a split second, before the page reloads back to a state of nothing being checked.
enter image description here

If you don't want to have the page reloaded, you can use event.preventDefault();. when you use the event prevent function, this function blocks reloading the page when clicking/pressing the "try it" button.

Check type of button in your code. If you want to submit form data then only add <input type="submit"> otherwise use <input type="button">
If checked and it is well, then It would be great to add your code here or screenshot of code.

Related

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.

Inspect where html pop is coming from

I have this annoying popup where it only displays the number 1. tried to search it manually in the system but there is too much others ones. is there a way where i could inspect a popup?
on your web page click on view page source by clicking on mouse right click or by ctrl+u with keyboard shortcode.
and then find:
alert(
and comment all alert box into your code.
Get id of that alert and search it manually. To get id, follow the image boxes or press CTRL+Shift+C and press ok. You will find function call in element section. go to the function and get your alert box.

HMTL - How to create a button without forwarding to the link

I wanna have a button which I want to press and open HTML web page in background. I don't want to see the site of my link. The link that I have in my code opens a site and this site is just a trigger for an application. So what I want to have is to press the button, execute the link in the background and stay on my site with my buttons.
How can I do that?
Right now I use this code and with this code I will be forwarded to my link. I have always to go back to press the next button.
This is part of my code:
<form>
<input type="button" value="Start" onclick="window.location.href='http://START'" />
</form>
I understand your question as follows:
After clicking a button, you want to open a url, but you don't want the browser to refresh. The url should be opened in the background.
Since javascript is an option, you should look into doing 'Ajax' calls.

Using a button as a link in HTML (form ASP.Net MVC 3)

My input pages have an OK and a Cancel button on them. These buttons are generated in a separate, partial view. The OK button is the submit for the form. The Cancel is a link to a different action. I can't make the Cancel button into a standard:
<form><input value="Cancel"></form>
as this would end up with nested forms which doesn't work (The form is on the outer, master view).
I can use Javascript, but I was hoping to have a page that would work without it.
I tried:
<button type="button">Stuff</button>
This works fine on Firefox, but does nothing on IE. Am I missing something here? Is there a simple way to get a button to work as a hyperlink?
You can always make the cancel button submit the form and make the redirect on the server side
you could CSS-style your link to look like a button.

Make link using submit button

Can I link one page to another page using submit button?
It sends all the wrong signals to the user, but:
<form action="some-uri"><div><input type="submit"></div></form>
The problem with using a submit form is that the next page will think that it has to deal with a binary request, which you can't do if using an upload form.
So you are better using a image button (can make it look like a submit button) or using JavaScript...
Open in a new window:
onClick="window.open('page.html');"
Open in the same window:
onClick="document.location.href = ('page.html');"