$('.create-box').on('click', function() {
window.location.href = "/photos/new/";
$('input#photo_picture').focus().trigger('click');
});
我想点击一个按钮来改变网址,然后在新页面上触发输入。
答案 0 :(得分:0)
在首页上使用此代码将页面网址更改为import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { routing,
appRoutingProviders } from './app.routing';
import { HeroesModule } from './heroes/heroes.module';
import { LoginComponent } from './login.component';
import { DialogService } from './dialog.service';
@NgModule({
imports: [
BrowserModule,
SharedModule.forRoot(),
routing,
HeroesModule
],
declarations: [
AppComponent,
LoginComponent
],
providers: [
appRoutingProviders
],
bootstrap: [ AppComponent ]
})
export class AppModule {
}
:
/photos/new/
在目标页面上,您可以使用以下代码专注于输入:
$('.create-box').on('click', function() {
window.location.href = "/photos/new/";
});