Can´t use ng-click function - javascript

I created a button dinamically with javascript and I added the ng-click="callSomething()" , when i render it, it have the corresponding class, but when I press the button it doesn´t work, I created a Button directly in the frontend with the same function and it works
This works
<button ng-click="callSomething(1231)" id="somethingButton">Change</button>
This isn´t working
button = `<td><button ng-click="callSomething(${data[i].order_number})" class="btn btn-primary" >Change</button></td>`
Please your help

Related

Close Tab not working properly using jquery

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 :)

A method in angular that simply closes the page when hit to a button

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();
}

Jquery Click button then trigger a button on second page with the same Class or ID

In my Project, I have a <button id="first" class="first" and I have a button with the same name and id on next page.
I want to trigger it when button on first page is clicked. Any thoughts how to do that?
I tried storing the button class on windows.LocalStorage and get the data on next page to be clicked but it's not working when opened in new tab.
thanks in Advance! hope you can help me.
You can't have two buttons with the same id or any two DOM elements in the same documents with the same id. So the solution to your issue, is to have different ids for each button. And do something as follows:
<button id="button1" #click="clickButton2()">Button 1</button>
<button id="button2" #click="doSomething()">Button 2</button>
While I would still recommend both #click to call doSomething, if for some reason you want to delegate clicking to the second button, your code for clickButton2() would be:
function clickButton2() {
document.getElementById('button2').click();
}

Disable a button where the Id that starts with

My buttons (it's inside a for loop) get a name from the database using .getName()
I'm trying to disable a button in javascript based on that name. But I can't seem to find the right way. Any help please?
HTML
<button class="btn btn-success btn-sm startDocker" id="start-<%=environment.getName()%>" name="<%=environment.getName()%>">Start</button>
This code is wrong.Now I wanted to disable the button with a the container.containerName
$('start-' + container.containerName).prop('disabled', true);

How to click on this button on Webpage using Perl and Mechanize

This may sound very simple to expirenced Perl Scripters, but I'm trying to click on a button on a webpage using Perl and the WWW::Mechanize::Firefox from CPAN. Here is the source code for the button:
<button type="submit" class="add-to-cart nsg-button--nike-orange" >
ADD TO CART
</button>
This is not the only button on the page by the way, my current method of trying to click on it is click_button => 'ADD TO CART' but that does not seem to be working for me. Any help on clicking this button is greatly needed. Thank you.
You should be able to call $mech->click({ selector => '.add_to_cart' });according to the documentation.

Categories