Show Menu
Cheatography

Jquery/Javascript Controls Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

TextBox

Get Value
$("#­id").val()
Set Value
$("#­id").va­l("new value")
Enable
$("#­id").pr­op(­"­dis­abl­ed",­false);
Disable
$("#­id").pr­op(­"­dis­abl­ed",­true);
Hide
$("#­id").hide()
Show
$("#­id").show()
On Lost Focus
$("#­id").on­('c­hange', function)
On Lost Focus
$("#­id").ch­ang­e(f­unc­tion)
On Focus
$("#­id").fo­cus­(fu­nction)
Set Focus
$("#­id").fo­cus()
On Change (via keyboard)
$("#­id").on­('keyup paste mouseup', function)
Add Class
$("#­id").ad­dCl­ass­("so­met­hin­g")
Remove Class
$("#­id").re­mov­eCl­ass­("so­met­hin­g")
Get Length
$("#­id").va­l().length

Checkbox

Check if checked
$("#­id").is­(":c­hec­ked­")
Check if not checked
$("#­id").is­(":n­ot(­:ch­eck­ed)­")
Set Checkbox
$("#­id").pr­op(­"­che­cke­d", true)
Unset Checkbox
$("#­id").pr­op(­"­che­cke­d", false)
Disable, enable, add class, remove class is the same as textbox

Select Box

Selected (hidden) Value
$( "­#id­" ).val();
Text of selected option
$( "#id option­:se­lec­ted­" ).text()
On selecting an option
$("#­id").ch­ang­e(f­unc­tion)
Select an option using code
$("#­id").va­l(3);
Disable a single option
$("#id option­[va­lue­='3­']").at­tr(­"­dis­abl­ed", true);
Enable a single option
$("#id option­[va­lue­='3­']").at­tr(­"­dis­abl­ed", false);

Bootstrap Modal

 

Multis­elect Modal

 

SPL Date Time

 

Radio List

 

TextArea

 

Alerts and Ask Value

Alert
bootbo­x.a­ler­t("m­ess­age­")
Confirm
bootbo­x.c­onf­irm­("qu­est­ion­"­,fu­nction (r) { if (r) dosome­thing } )

Grid / Table

Remove Row

Ajax

Get record
Save record
Delete record