Quantcast
Channel: SharePoint Journey
Viewing all articles
Browse latest Browse all 542

Drop down selection change event in React Js in SPFX webpart

$
0
0
import * as React from 'react'; 
import styles from './Reactspfx.module.scss'; 
import { IReactspfxProps } from './IReactspfxProps'; 
import { escape } from '@microsoft/sp-lodash-subset'; 
export interface IReactGetItemsState
{ selectValue:string }
 export default class Reactspfx extends React.Component { 
public constructor(props: IReactspfxProps) {
 super(props); 
this.state = { 
selectValue:"Radish"
 };
}
handleChange = (event) => { this.setState({selectValue:event.target.value}); alert(event.target.value); };
public render(): React.ReactElement { alert(this.state.selectValue); return (
<selectvalue={this.state.selectValue}onChange={this.handleChange}>
<optionvalue="Orange">Orange</option>
<optionvalue="Radish">Radish</option>
<optionvalue="Cherry">Cherry</option>
</select>
);
}

Viewing all articles
Browse latest Browse all 542

Trending Articles