我有两个单选按钮更改事件我想要更改按钮怎么可能?我的守则
<input type="radio" name="bedStatus" id="allot" checked="checked" value="allot">Allot
<input type="radio" name="bedStatus" id="transfer" value="transfer">Transfer
Run Code Online (Sandbox Code Playgroud)
脚本
<script>
$(document).ready(function () {
$('input:radio[name=bedStatus]:checked').change(function () {
if ($("input[name='bedStatus']:checked").val() == 'allot') {
alert("Allot Thai Gayo Bhai");
}
if ($("input[name='bedStatus']:checked").val() == 'transfer') {
alert("Transfer Thai Gayo");
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud) $(document).ready(function(){
$('.owl-carousel').owlCarousel({
loop:true,
margin:10,
nav:true,
items: 1
})
});Run Code Online (Sandbox Code Playgroud)
<div class="owl-carousel">
<div class="item"><h4>1</h4></div>
</div>
<link href="http://www.owlcarousel.owlgraphic.com/assets/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://www.owlcarousel.owlgraphic.com/assets/owlcarousel/owl.carousel.js"></script>Run Code Online (Sandbox Code Playgroud)
控制台错误:TypeError:items [clones [(clones.length - 1)]]未定义.
由于只有一个项目div和属性循环true和项目1,这个错误.所以.这种情况下的任何解决方案 我知道这种情况不会发生但如果有任何解决方案请告诉我非常感谢.
import AlphService from './AlphService';
export default class MyClass extends React.Component {
alphService;
constructor(props) {
super(props);
alphService = new AlphService();
this.state = alphService.getState();
}
componentWillMount() {
this.play(this.state.sound);
}
play(source) {
console.log(source);
Audio.setIsEnabledAsync(true);
const sound = new Audio.Sound();
const play_sound = (async () => {
await sound.loadAsync(require(source)); //Error Here
await sound.playAsync();
})();
}
}
Run Code Online (Sandbox Code Playgroud)
阿尔夫服务.js
export default class alphService {
stateObj = {
sound: ""
};
getState(){
this.stateObj.sound = "../assets/sounds/c.mp3";
return this.stateObj;
}
}
Run Code Online (Sandbox Code Playgroud)
错误:components/Alphabet.js:第 51 行的调用无效:需要(来源)
并尝试require(soundPathVar)从getState()方法返回对象并从 …
我正在使用onchange event of select boxjquery.我display property = none在其他div中给出了改变.问题是,当我从数据库获取数据并将其设置在选择框中时,因此onchange属性不会应用于给定值.为什么?我的代码
<select id="patientType" name="Patient_Type">
<option value="">--SELECT--</option>
<option value="OPD">OPD</option>
<option value="IPD">IPD</option>
</select>
<div id="roomInfo" clasas="inactive"></div>
Run Code Online (Sandbox Code Playgroud)
脚本
$('#patientType').change(function() {
if ($('#patientType').val() == 'IPD') {
if ($('#roomInfo').hasClass('inactive')) {
$('#roomInfo').removeClass('inactive');// CSS Property Display None in this class
$('#roomInfo').addClass('active');
}
} else {
if ($('#roomInfo').hasClass('active')) {
$('#roomInfo').removeClass('active');
$('#roomInfo').addClass('inactive');
}
}
});
Run Code Online (Sandbox Code Playgroud)
现在我从数据库获取数据并将其设置为选择patientType $('#patientType').val(数据从数据库中获取); 不能申请onchange事件申请,不显示我的roomInfo div所以它是否可能.或另一种获得该方法的方法.请帮忙.提前致谢.