I'm using the current version of Foundation.
I've implemented a content drop-down which I show on a button click.
The problem is: on some conditions I disable the button. In this case it shouldn't be possible to open the content drop-down.
But it's still possible to open the drop-down on click, even with the disabled button.
Is there any solution to prevent it?
Really need to see some code or an example pen. Have you tried using the prevent default function? event.preventDefault();
<button type="button" id="ptorEditDocuments" class="button pull-left button-center sm" data-dropdown="bl-document-edit-dropdown" aria-controls="bl-document-edit-dropdown" aria-expanded="false" title="Edit" ng-disabled="documents.length<1">
<i class="ic ic-edit-sm-blk"></i>
</button>
Solution was, that some controls were not right defined.
That was a fault of a previous implementation. I'm new to foundation and didn#t got it directly.
Thanks guys.
Related
I am working on MCV core with the Dapper project. On one of my pages, I have a Grid that contains records and ACTION,
No Name Address Mobile UPDATE VIEW
1 XYZ XYZ 123 UPDATE VIEW
2 XYZ XYZ 456 UPDATE VIEW
When I click on the UPDATE Link from a specific row I am opening my new PAGE
updareUserRecord.cshtml IN NEW TAB.
When I click on UPDATE BUTTON after updating the record in updareUserRecord.cshtml, record gets updated. On the SAME page, I have CLOSE BUTTON. I want to close the updareUserRecord.cshtml. Only.
Using Jquery and Javascript I have tried but some times below code work sometimes not. Can Anyone give me the perfect solution?
Like no matter, I want to close the PAGE.
This is the code I have tried.
#*<button type="button" class="btn btn-primary" id="btnClose" onclick="javascript:window.open('','_self').close();">Close</button>*#
<button type="button" class="btn btn-primary" id="btnClose" onclick="window.top.close();">Close</button>
<button type="button" class="btn btn-primary" id="btnClose" onclick="window.close();">Close</button>
You can add simply click function using jQuery
$('#btnClose').click(function () {
window.close(); //through writing this statement working also in browser
console
});
I think helps this solution Thank you :)
To exit a window or Angular page I have created an Exit button in the .html. To make the button work I want to write a method in the .ts file that will help me simply close the page.
Note: I am using Angular11 and Bootstrap 4.
Help me write the method.
I'd suggest you share a piece of code you have tried first before asking the question like that. Anyways here's something you can do:
In Html:
<button type="button" class="btn btn-link" (click)="closePage()">Close Page</button>
In TS:
closePage(){
window.close();
}
I am currently working in a web application which has dojo in client side.Now for browser IE11 I am facing a scrolling issue for the following component
<button dojoType="dijit.form.Button" type="submit" name="favouriteList" value="favoriteList" onclick="buttonfix(this);"/>
The Problem I am facing is in some pages where scrolling is coming,when user scrolls down to button of the page(since the buttons are at button of the page)and clicks on the button,no action is fired and the page scrolls up to the top..To be noted this is happening only on first click on the button.Now if user again scrolls to the bottom and places the cursor on button and clicks it then the corresponding action is getting fired.
From my First inspection I got the impression that dojo is probably the cause of this problem.Sop,I tried the following:
I removed the dojoType="dijit.form.Button" attribute.It resolved the issue.But unfortunately It is not acceptable since in our project we need to keep intact dojo.Our dojo version is 2.1.
The entire generated html for a particular button of my project is below:
<button name="favouriteList" tabindex="0" class="dijitReset dijitStretch dijitButtonContents" id="dijit_form_Button_9" role="button" aria-labelledby="dijit_form_Button_9_label" type="submit" waistate="labelledby-dijit_form_Button_9_label" wairole="button" dojoattachpoint="titleNode,focusNode" value="favouriteList">
<span class="dijitReset dijitInline" dojoattachpoint="iconNode">
<span class="dijitReset dijitToggleButtonIconChar">
</span>
</span>
<span class="dijitReset dijitInline dijitButtonText" id="dijit_form_Button_9_label" dojoattachpoint="containerNode">favouriteList</span>
</button>
Below is the code for buttonfix(this) function:
<script type="text/javascript">
function buttonfix(dojoButton) {
var button;
if(dojoButton.id==""){
button = dojoButton;
} else {
button=document.getElementById(dojoButton.id)
}
for(j=0; j<button.form.elements.length; j++)
if(button.form.elements[j].tagName == 'BUTTON' )
button.form.elements[j].disabled = true;
button.disabled=false;
}
</script>
so,can anyone provide me any other solution to this???
I might be misunderstanding the question, but...
The scroll upwards is probably because the form is posted, triggering a reload of the page. Perhaps you could try changing your onclick to:
onclick="buttonfix(this);return false"
This would prevent the submit.
Set scrollOnFocus:false within the properties of the dojo button - https://dojotoolkit.org/api/#1_10dijit_form_Button_scrollOnFocus
I have a form which users can use to send an ecard.
This is an example URL:
http://jimpix.co.uk/ecards/normal-ecard.asp?id=5480
At the bottom of the form there is this HTML (covering the send buttons):
<div class="col-lg-6">
<legend>Next bit...</legend>
<button type="button" id="BtnPrev" class="btn btn-info" onclick="return valFormPrev(theForm,'preview');"/>Preview Your Ecard</button>
<button type="button" id="BtnGo" class="btn btn-success" class="preview" onclick="return valFormGo(theForm,'process');"/>Send Now</button>
<p class="top10">Reset buttons so you can use them again</p>
</div>
Because the page can take a while to process when users click on a button, I added this to the end of the JS used to validate the forms (located at http://jimpix.co.uk/dist/js/ecard.js)
Say a user clicks the "Send Now" button, it calls the "valFormGo" function.
That contains this code near the end:
document.getElementById("BtnGo").disabled = 'true';
That disables the button if the user click on it, so they can't click it many times and send the same ecard many times.
That seems to work okay, but if, once they have sent the ecard, they press the back button to e.g. send again to someone else, the button remains disabled, even if the page is refreshed.
I had to set up a function to allow them to make the buttons active again via:
function ResetBtns()
{
document.getElementById('BtnPrev').removeAttribute("disabled");
document.getElementById('BtnGo').removeAttribute("disabled");
}
That works, but it is clunky.
I just wondered if anyone knows of a more elegant solution I might be able to follow to disable the button when pressed, or maybe have the button change the text to say "processing..." when it is waiting for the next page to process the data.
Basically I have made a hack job of this and it would be much appreciated if anyone might be able to advise please on possible alternatives.
Any advice would be much appreciated.
Thanks
Why not process the ecard on the same page using ajax method, then on success you can un-disable the submit button.
Can't really offer any code at this time as not sure of your current flow / method being used.
Try this:
//to disable buttons
$('BtnPrev').click(function(){
this.prop('disabled', true);
});
$('BtnGo').click(function(){
this.prop('disabled', true);
});
//to enable buttons
function ResetBtns() {
$('BtnPrev').prop('disabled', false);
$('BtnGo').prop('disabled', false);
}
Just make the function run like this:
<button onclick="myfunction()" id="activate"></button>
<script>
function myfunction(){if(unrun==true){unrun=false;
document.getElementById("activate").innerHTML="Processing....";
code goes here;}}
</script>
just i want to make back button in my site. once i click the button it need to take the url in to previous page. how can i make this using jquery?
<button type="button" onclick="history.back();">Back</button>
the answer by wRAR is correct, you can use history.back or history.go(-1). However, if you are using ajax, you might need a bit more than that.
Stephen Walter has a nice article on how to use jQuery, ASP.NET, and Browser History which basically describes how to save and restore the application state yourself. I recommend you give a read.
Elijah Manor(co-host of the Official jQuery Podcast) has also written a nice article about this topic.
I hope this helps
-D
Try this: am using materialise css.
<button id="back_btn" class="btn waves-effect waves-light" name="action">Back<i class="material-icons left">chevron_left</i>
</button>
In your jquery script file add
$("#back_btn").click(function (){
window.history.back();
});
within the document ready function.
For JQM, this works!
$(document).ready(function(){
$('.backLink').click(function(){
parent.history.back();
return false;
});
});
This is what I have successfully used in one of my recent projects:
<script>
function goBack() {
window.history.back();
}
</script>
<a href="#" onclick="goBack()" class="btn-event-show-video">
Return to Stand
</a>
I think button onclick="history.back();" is one way to solve the problem.But it might not work in the following cases:
If the page gets refreshed or reloaded.
If the user opens the link in a new page.
To overcome these, the following code could be used if you know which page you have to return to.
E.g. If you have a no of links on one page and the back button is to be used to return to that page.
<input type="button" onclick="document.location.href='filename';" value="Back" name="button" class="btn">