How to bind ‘touchstart’ and ‘click’ events but not respond to both?

I’m working on a mobile web site that has to work on a variety of devices. The ones giving me a headache at the moment are BlackBerry. We need to support both keyboard clicks as well as touch events. Ideally I’d just use: $thing.click(function(){…}) but the issue we’re running into is that some of these … Read more

How to trigger a click on a link using jQuery

I have a link: <ul id=”titleee” class=”gallery”> <li> <a href=”#inline” rel=”prettyPhoto”>Talent</a> </li> </ul> and I am trying to trigger it by using: $(document).ready(function() { $(‘#titleee’).find(‘a’).trigger(‘click’); }); But it doesn’t work. I’ve also tried: $(‘#titleee a’).trigger(‘click’); Edit: I actually need to trigger whatever get’s called here <a href=”#inline” rel=”prettyPhoto”> 12 Answers 12

Difference between .on(‘click’) vs .click()

Is there any difference between the following code? $(‘#whatever’).on(‘click’, function() { /* your code here */ }); and $(‘#whatever’).click(function() { /* your code here */ }); 12 s 12 I think, the difference is in usage patterns. I would prefer .on over .click because the former can use less memory and work for dynamically added … Read more

How to create a checkbox with a clickable label?

How can I create an HTML checkbox with a label that is clickable (this means that clicking on the label turns the checkbox on/off)? 12 s 12 Method 1: Wrap Label Tag Wrap the checkbox within a label tag: <label><input type=”checkbox” name=”checkbox” value=”value”>Text</label> Method 2: Use the for Attribute Use the for attribute (match the … Read more