Print

Print


Cool, thanks. Good info! 

I did know it was HTML5 schtuff, but haven't used the data() method before. Unfortunately it doesn't work in this case. 

- Gavin

>>> Michael Schofield <[log in to unmask]> 11/30/2012 9:21 AM >>>
Friendly FYI :-). "data-mini=true" is an HTML5 data attribute. So, in the
source it might look like:

<input id='foo' class='search' data-mini='true'>

When talking to data-attributes with jQuery, you might be able to eke out
better performance using .data('mini'). E.g.:

$('input').data('mini', 'true');

Rather than having jQuery look for an attribute called data-mini, it will
hone in directly on any present "data-" then match with "mini."

Here's some further reading: http://api.jquery.com/data/

Good luck! I hope you share the final result.

Michael Schofield(@nova.edu) | @gollydamn | www.ns4lib.com


-----Original Message-----
From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of
Gavin Spomer
Sent: Friday, November 30, 2012 11:52 AM
To: [log in to unmask]
Subject: Re: [CODE4LIB] jQuery Set data-mini Attribute For All Form Inputs

Thanks for the input, Mark.

I don't think there is a textinput method in jQuery or jQuery Mobile.

- Gavin

>>> Mark Pernotto <[log in to unmask]> 11/29/2012 3:58 PM >>>
This looks more syntactical than anything else.

Try:

$('input').textinput({mini:true});

This hasn't been tested.

Thanks,
Mark


On Thu, Nov 29, 2012 at 3:40 PM, Gavin Spomer <[log in to unmask]> wrote:
> Hello,
>
> I'm almost done developing my custom theme for when I migrate our
Greenstone digital collections over to Omeka. I've built in a mobile
interface for when a mobile device is detected and have been having a lot of
fun implementing that with jQuery Mobile.

>
> I prefer to make most stuff "mini" ala the jQuery Mobile data-mini
attribute. Works fine when I'm editing the actual html source, but the
following won't work for some reason:
>
>    $(document).ready(function() {
>       $('input').attr('data-mini', 'true');
>    });
>
> I can set other attributes successfully like: (just as a test)
>
>    $(document).ready(function() {
>       $('input').attr('data-mini', 'true');
>       $('input').attr('style', 'background:yellow');
>    });
>
> But for some reason it won't do the data-mini attribute... why?
> Gavin Spomer
> Systems Programmer
> Brooks Library
> Central Washington University