EventPrices += "<div class='after-price' id=divPrice>";
if (localStorage.getItem('SelectedRoleName') != null)
{
if (localStorage.getItem('SelectedRoleName').toString().trim() == "Admin") {
EventPrices += "<span class='price'><input type='radio' value='" + Item.PriceId + "' id='chkEventPrices' class='fa fa-check' name='chkEventPrices' title='" + Item.Price + "' onclick='CalculateTotal();'><label> $" + Item.Price + " </label> </span> ";
}
else {
EventPrices += "<span class='price'><input type='radio' value='" + Item.PriceId + "' id='chkEventPrices' disabled= 'disabled' class='fa fa-check' name='chkEventPrices' title='" + Item.Price + "' onclick='CalculateTotal();'><label> $" + Item.Price + " </label> </span> ";
}
} else {
EventPrices += "<span class='price'><input type='radio' value='" + Item.PriceId + "' id='chkEventPrices' disabled= 'disabled' class='fa fa-check' name='chkEventPrices' title='" + Item.Price + "' onclick='CalculateTotal();'><label> $" + Item.Price + " </label> </span> ";
}
EventPrices += "<span class='date'>After " + moment(Item.EarlyBirdDate).format("MMM DD, YYYY") + " </span>";
EventPrices += "</div></div>";
EventPrices += "<div><span id='spnEventPriceLiteralDetails_" + i + "'>" + EventPriceLiteraldetals + "</span></div>";
}
EventPrices += "</div><br/>";
i++;
});
这是我的代码。如果我点击它正在拍摄的特定单选按钮..我想如果我点击框只有单选按钮将选择。
答案 0 :(得分:0)
$('input[type=radio]').click(function() {
$("#isClicked").text("selected radio value is " + ($('input[type=radio]:checked').val() == "1" ? "Male" : "Female"));
});
&#13;
.hidden {
display: none;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<label for="r1"> Male
<input type="radio" class="hidden" name="group1" id="r1" value="1" />
</label>
<label for="r2"> FeMale
<input type="radio" class="hidden" name="group1" id="r2" value="2" />
</label>
<br />
<div id="isClicked"></div>
&#13;
请检查一下。用户点击标签时,会触发相应的单选按钮点击事件。
答案 1 :(得分:0)
根据你 radio
,我猜你的功能正在点击单选按钮。
因此,如果您希望我们可以使用jQuery的`.trigger',那么我们假设.radio
按钮类是.test
而'div'类是$('body).on('click',`.test`,function(){
$('.radio').trigger('click');
});
。
例如:
#import "UIImageView+WebCache.h"
// imageView.image = [UIImage imageNamed:[self.imagesData objectAtIndex:i]]; comment this line and replace with bottom line
[imageView sd_setImageWithURL:[NSURL URLWithString:[self.imagesData objectAtIndex:i]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
这将按照me.ty
运作