I have a mobile site that uses the jQuery Mobile library along with html5. On this site I have made use of placeholders to label inputs (as I have hidden the labels).
However we all know that IE are inept and didn't support placeholders until IE10 but my client wants this to also work in IE9 (why he would want support for this on a mobile site is beyond me).
I have downloaded and installed the latest version of the modernizr script yet the placeholders still don't show up. Is there anything I need to do to make this work?
My included scripts:
<script src="/Scripts/jquery-2.0.3.js"></script>
<script src="/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="/Scripts/jquery.mobile-1.3.1.js"></script>
<script src="/Scripts/modernizr-2.6.2.js"></script>
Example html input
<input class="textbox" data-val="true" data-val-length="The field Surname * must be a string with a maximum length of 150." data-val-length-max="150" data-val-required="Please enter your surname." id="Surname" name="Surname" placeholder="Surame *" type="text" value="" />
Example Fiddle
Modernizr does not add the placeholders or any other functionality to old browsers.
Modernizr is simply a script that allows you to tell whether a browser supports any given feature or not. You still need to act on the information that Modernizr gives you, and implement the placeholder functionality if Modernizr tells you that it isn't supported.
Modernizr even provide a wiki page that lists a load of Polyfill scripts you can use for various features: https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills
Pick one of the placeholder scripts from that page, and do something like this:
Modernizr.load({
test: Modernizr.input.placeholder,
nope: 'placeholder-polyfill.js'
});
Related
So I want to use a document upload element in a web form using JQuery Mobile. Every mobile platform in my testing environment allows it, (only small additional styling is allowed but some none the less) until I come to IE and IE Mobile. It is all scew-whiff in both and doesn't function at all in IE Mobile.
Am I missing some secret documentation or am I being stupid expecting IE to behave like others... I am going to guess that yet again, they are laughing in the face of conformity.
Thank you for any input and advice.
In regards to code, I am not using anything fancier then:
<input name="exampleName" class="exampleClass" id="exampleDocument" type="file" size="250" value=""/>
<!--and Jquery Mobile changes the class name to input ui-input-text ui-body-a-->
IE for Windows Phone 7/8 as like iOS 5 and lower don't support file upload from web browser. File Upload Support
I would like to focus on a text input field immediately on page load. However the following code, that works on desktop browsers, doesn't work on mobile Safari (on iOS 6).:
<input type="text" name="q" class="search" id="focusme" />
...
<script type="text/javascript">
window.onload=function(){var a=document.getElementById("focusme");a.focus();}
</script>
I have tried to implement several suggested fixes for this. However I haven't been able to get it working. It does display the CSS changes to the field when it is in focus, however the keyboard is not brought up.
I suspect this may be due to my currently very limited understanding of JavaScript, but I think it may still be a bug in Safari.
The question:
In Safari on iOS 6, Do you know of any way to auto focus on a text input field on page load?
Thank you for your help :-)
Update:
The page does have jquery and mobile-jquery available, if they need to be used.
Why using JavaScript? <input type="text" autofocus /> should do it!
Is it possible to use a jQuery UI widget with a google apps script application?
I have a textbox and I would like to use a date picker on it.
Yes you can use JQueryUI with Google Apps Script. I suggest you look at example code, there's nothing special you need to do to make them work. Just make sure to develop your application using HtmlService and not UiService, you can't mix and match. Here's an example I lifted straight from them:
Code.gs
function doGet() {
return HtmlService.createHtmlOutputFromFile('test.html');
}
test.html
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
</head>
<body>
<div>Choose date:<input type="text" name="date" id="datepicker" /></div>
<script>
$("#datepicker").datepicker();
</script>
</body>
</html>
Google Apps Script has built in DateBox and DatePicker classes in the UiApp Service. They are not yet in the documentation but if you type the reference to a UI instance into the Script Editor and add the trailing period, there are create methods for both. Google says they are working on adding the documentation. See here
You must watch the new services of google apps script:
Google I/O 2012 - Use What You Know: HTML and JavaScript in Apps Script
No, in Google Apps Script you're limited to use the provided APIs. Specially when talking about Ui.
I want to use the Jquery UI Theme Switcher Widget on my page.
The problem is the Switcher is hosted via http and my page is a https page.
So I get security errors including the switcher.
Does anyone know if I can get the source of the switcher so I can host it on my site?
Or are there any third party switcher scripts that I could use?
Thanks!
For anyone that lands here. Here is what I found.
A list of 10 of them is here: (update link is dead now - Apr 2016)
http://www.net-kit.com/10-practical-jquery-style-switchers/
A replacement for the jquery theme switcher that you can run locally is here:
https://github.com/harborhoffer/Super-Theme-Switcher
I don't know about any other third party implementations, but it's easy to do yourself too. Just set an id on a link element and use jQuery to change the src attribute when a select box changes. Abstracting it into a plugin is pretty easy as well.
I don't want to sound like I am promoting a project I did, but I wrote a jQuery-UI theme switcher based on the themeswitchertool, in order to create one that actually works as advertised. Mine does not link to all the themes by default, but enables you to add any theme you want. Adding all the themes from the jQuery-UI site is trivial.
There is also Super Theme Switcher, which everyone else seems to be using, but it is not as feature-rich as mine, due to it being a port of the old themeswitchertool. This one DOES link all the jQuery UI themes by default.
I had similar errors so I downloaded the js from http://jqueryui.com/themeroller/themeswitchertool/, saved it as jquery.themeswitcher.js and replaced all http jquery-ui urls with google apis https urls.
The only changes were in the var switcherpane where each link looks like:
<li><a href=
"http://jqueryui.com/themeroller/css/parseTheme.css.php?....">
<img src=
"http://jqueryui.com/themeroller/images/themeGallery/theme_90_ui_dark.png" alt=
"UI Darkness" title="UI Darkness" /> <span class="themeName">UI
darkness</span></a></li>
Which I replaced with:
<li><a href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/themes/ui-lightness/jquery-ui.css">
<img src="content/images/theme_90_ui_light.png" alt="UI Lightness" title=
"UI Lightness" /><span class="themeName">UI lightness</span></a></li>
If you search through the file there are a few other html images that are referenced further down.
You can find all the images here
You can simply set the src links to "https" and it will work fine.
<link rel="stylesheet" href="themes/MyTheme.min.css" />
<link rel="stylesheet" href="themes/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.1/jquery.mobile.structure-1.4.1.min.css" />
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.js"></script>
I'm building a mobile oriented web site.
New phones most of all use new browsers which support html5 and css3. Very often they have touch screens. Probably owner of iPhone4 or Galaxy does not bother about page size so much - so it IMHO it is a good idea to use jQueryMobile for such user.
On the other hand there are smartphones which are also have touch screens but screen resolution is too small (i.e. 240x320) to use jQueryMobile.
There are also a number of phones which do not have touch screens and also there are number of users who switch off Javascript to do not load js files and save their money.
I tried to use Modernizr to determine if mobile phone supports touchscreen but unfortunately Modernizr.touch only shows if a browser support it.
It is known to use CSS Media Query Modernizr.mq() to determine the screen size and load different css files base on it but this solution doesn't solve problem with switched off javascript and old browsers like IE8.
There is also a good article http://www.alistapart.com/articles/return-of-the-mobile-stylesheet but unfortunately it has basically ideas not implementation.
Question: I'd like to load jQuery mobile for smartphones with min-width 480px. Otherwise load default css. It is possible to implement this for as many as possible mobile browsers?
Answer (result code):
<html class="defcss">
<head>
<link href="/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="#Url.Content( "~/Scripts/yepnope.js" )"></script>
<script type="text/javascript">
//<![CDATA[
if (window.screen.availWidth > 450) {
document.documentElement.className = document.documentElement.className.replace(/\bdefcss\b/, '');
yepnope(['//code.jquery.com/jquery-1.6.4.min.js',
'//code.jquery.com/mobile/1.0rc3/jquery.mobile-1.0rc3.min.js',
'//code.jquery.com/mobile/1.0rc3/jquery.mobile-1.0rc3.min.css']);
}
//]]>
</script>
I would look into something server side and generate the files needed, Take a look at:
http://code.google.com/p/mobileesp/
http://blog.mobileesp.com/
http://wurfl.sourceforge.net/
http://www.handsetdetection.com/
There are some client side scripts but I haven't used any of them yet:
https://github.com/sebarmeli/JS-Redirection-Mobile-Site
https://github.com/miohtama/detectmobile.js
Related:
Mobile detection
Also what about Tablets?