Reputation: 1059
I am doing web app for iOS using jQuery. I have a select in one page. According to the requirement I have to disable it.
<select name="select-choice-a" id="selectCardType" data-native-menu="false">
<option value="select">Select Card Type</option>
<option value="A">American Express</option>
<option value="M">Master Card</option>
<option value="V">Visa</option>
</select>
I have 2 scenario 'The user can come to the page directly or form another app by url scheme'
I have used
$('#selectCardType').selectmenu('disable');
or
'$('#selectCardType').attr('disabled', 'disabled'); `
But it is not working for me in either case.
Upvotes: 1
Views: 5377
Reputation: 97
Very similar to here. I had the same issue, was trying to use:
$("selectId").selectmenu("disable");
It wouldn't work until I added a # in front of the ID, i.e.
$("#selectId").selectmenu("disable");
Now it works.
Upvotes: 0
Reputation: 1059
thanks for your help. I got the solution.
create one global variable var onceVisitedCardpage = false;
if you have visited that page then make this variable as true
then check the state of that variable before coming to that page
if(onceVisitedCardpage)
$('#selectCardType').selectmenu('disable');
else
$('#selectCardType').attr("disabled", "disabled");
By this way I manage to handle both the senario.
Upvotes: 2
Reputation: 75113
If I disable a simple select ... it is disabled in any browser (including iOS)
demo: http://jsbin.com/unezod/2/
$("#selectCardType").prop("disabled", true);
This is how the link above shows:
Upvotes: 0