Trigger the event:
- Jan 22 Wed 2014 13:56
jQuery: Radio Button, Checkbox and Selecter
- Jan 21 Tue 2014 21:56
jQuery: Radio Button, Checkbox and Selecter
Trigger the event:
$("input[name='lom']").change(function(){
// Do something interesting here
});
Radio Button:
To get the selected value:
var v=$('input[name=Sex]:checked').val();
if( typeof(v) == 'undefined'){
//there's no button selected
}
To select radio button from value:
$("input[name=Sex][value='2']").attr('checked',true);
To select radio button from index:
$('input[name=Sex]')[1].checked = true;
Checkbox:
To see whether checkbox is checked:
$('#chk').is(':checked');
To set checkbox:
$("#chk1").attr("checked",'');
$("#chk2").attr("checked",true);
Selecter:
To get the selected value:
$('#selectList').val();
$('#selectList :selected').text();
To add a new option:
$('#selectList').addOption(value,text);
- Jan 20 Mon 2014 11:37
Ajax pageview of Google Analytics
- Jan 19 Sun 2014 19:37
Ajax pageview of Google Analytics
first, to be sure the google analytics api is new version, such as
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxx-x']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
the way 1. use ajaxSetup for all calls to $.ajax.
- Jan 12 Sun 2014 12:19
jQuery: placeholder fixed for IE 8
$(document).ready(function () {
$('[placeholder]').focus(function () {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function () {
var input = $(this);
if (input.val() == '' || input.val() == input.attr('placeholder')) {
input.addClass('placeholder');
input.val(input.attr('placeholder'));
}
}).blur();
$('[placeholder]').parents('form').submit(function () {
$(this).find('[placeholder]').each(function () {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
}
})
});
});
CSS Styling
::-webkit-input-placeholder {
color: red;
}
:-moz-placeholder {
color: red;
}
.placeholder {
color: #ccc;
}
- Nov 03 Thu 2011 15:26
ASP.Net using Word Automation in Windows Server 2008
- Nov 03 Thu 2011 12:26
ASP.Net using Word Automation in Windows Server 2008
Environmental Setting
1. Install office 2003