Archive

Archive for the ‘jquery’ Category

Bootstrap Twitter Button

May 24, 2013 Leave a comment

The other day, while putting together Tweet My Search, I was looking for a twitter icon that I could put as an icon on a bootstrap button. By default, the bootstrap library (as far as I know) does not come with the twitter icon, even though it’s a twitter product.

So I put this snippet together — feel free to improve

http://jsfiddle.net/LeAQN/embedded/result/

Advertisements
Categories: bootstrap, jquery

jquery colorbox as simple dialog

October 8, 2012 Leave a comment

I’ve been working with opencart for a while now, and like the choice of jquery libraries that have been chosen for the project.  Recently I was developing a custom extension for opencart that required a simple dialog to appear before deleting a record.  Opencart is using the excellent colorbox jquery plugin for lightboxes and I wanted to see if I could leverage the plugin for a simple jquery dialog.

I ended up using the following code:

<a onclick="delete_entry_dialog(<?php echo $entry['id'] ?>)">Remove</a>

<div style="display:none">
 <div id="delete_entry_dialog">
 <p>
    Are you sure you want to delete this entry?
 </p>
 <a id="delete_dialog_continue">Continue</a> or <a onclick="$.colorbox.close()">Cancel</a>
 </div>
</div>

<script type="text/javascript">
function delete_entry_dialog(id) {    
    $.colorbox({inline:true, href:'#delete_entry_dialog'});
    $('#delete_dialog_continue').bind('click', function() {
       delete_entry(id); 
       $.colorbox.close();
    });
}
</script>
Categories: jquery

jquery focus after blur

November 21, 2011 Leave a comment

Need to focus() on the input field after the user has clicked or tabbed off the input field?

See below:
http://forum.jquery.com/topic/jquery-focus-after-blur

You might also want to add a .select() to re-select the input field causing the problem (if it’s a text field)

 

Categories: jquery