have a simple music app that I'm making. I have 7 "radio station" buttons set up to update the same elements in 7 different ways. I want to update the mp3 filepath (src attribute), the name of the song, the name of the artist, and the name of the station.
This is an example of how it looks in my jQuery code...
$('.deg295').click(function () { //One of the buttons
$('audio source').attr('src', 'music/panda.mp3'); //The mp3 filepath
$('.labels p:nth-child(1) em').text("Urban Beach Radio") //The station name
$('.labels p:nth-child(2)').text("PANDA"); //The song name
$('.labels p:last-child').text("Desiigner"); // The artist name
radio.load();
radio.play();
});
Meanwhile, here's the component in question...
var React = require('react');
let rock = require('../images/pngs/rock.png');
let none = require('../images/pngs/none.png');
let blue = require('../images/pngs/blue.png');
let flash = require('../images/pngs/flash.png');
let estim = require('../images/pngs/estim.png');
let urban = require('../images/pngs/urban.png');
let intl = require('../images/pngs/intl.png');
//The radioClass prop == "radio"
export default class Radio extends React.Component {
render() {
return (
<section className={this.props.radioClass}>
<div className="septagon">
//These are the 3 labels I want to update onClick
<div className="labels">
<p>
<em></em>
</p>
<p>Radio</p>
<p>Off</p>
</div>
//The 7 buttons are below
<span className="deg40"><img src={rock} alt="" /></span>
<span className="deg90"><img src={none} alt="" /></span>
<span className="deg140"><img src={blue} alt="" /></span>
<span className="deg195"><img src={flash} alt="" /></span>
<span className="deg245"><img src={estim} alt="" /></span>
<span className="deg295"><img src={urban} alt="" /></span>
<span className="deg345"><img src={intl} alt="" /></span>
//The audio element with the mp3 filepath that I also want to update
<audio id="playmusic" preload="none">
<source type="audio/mpeg" src="" id="audio"/>
</audio>
</div>
</section>
)