我试图在用户点击选择中的选项时发出提醒。
NSError *jsonError;
NSData *objectData = [@"{\n \"GCM\":{\n \"data\":{\n \"notificationType\":\"order\",\n \"oid\":\"CRN14333313\",\n \"c\":\"allocated\",\n \"f\":\"253.633333333333\" }\n }\n }" dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:objectData
options:NSJSONReadingMutableContainers
error:&jsonError];
NSLog(@"dictionary is : %@",json);
你会怎么做?
答案 0 :(得分:5)
始终直接挂钩change
的{{1}}事件,否则只使用键盘浏览网页的用户无法激活JS收听的事件。
select
答案 1 :(得分:1)
只需使用以下代码:
//*[contains(., 'v_search')]
/ancestor-or-self::*
/*[local-name()='name' and @locale='en']
|
//*[text()[contains(.,'v_search')]]
/following-sibling::*
/*[local-name()='name' and @locale='en']
答案 2 :(得分:1)
以下是您的操作方法:
$(document).ready(function() {
$('#Menunavigation').on('change', function() {
alert('You selected - ' + $(this).val())
})
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="Menunavigation" class="cs-select cs-skin-slide">
<option value="Home" data-class="icon-home-cod">Start</option>
<option value="About" data-class="icon-about-cod">About</option>
<option value="Services" data-class="icon-services-cod">Start</option>
<option value="Work" data-class="icon-work-cod">Work</option>
<option value="Contact" data-class="icon-contact-cod">contact</option>
</select>
答案 3 :(得分:0)
您需要在change
事件上附加您的功能,如下所示:
$('#Menunavigation').on('change', function() {
alert('Worked.');
});
// Or slightly shorter version
$('#Menunavigation').change(function() {
alert('Worked.');
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="Menunavigation" class="cs-select cs-skin-slide">
<option value="Home" data-class="icon-home-cod">Start</option>
<option value="About" data-class="icon-about-cod">About</option>
<option value="Services" data-class="icon-services-cod">Start</option>
<option value="Work" data-class="icon-work-cod">Work</option>
<option value="Contact" data-class="icon-contact-cod">contact</option>
</select>
&#13;