Author Archives: coja

JQuery Mobile: Checkbox Issue

I have been trying to manipulate checkbox via JavaScript.
Long time spent to find out why the regular JQuery Code doesn’t work with JQuery Mobile.
Finally I resolved the issue.
Review the code below to understand the solution.

[javascript]
$(‘input.credits[chk="chk"]‘).attr(‘selected’,'selected’).checkboxradio("refresh");
[/javascript]

The code

.checkboxradio("refresh");

must be added every time the checkbox value changed.

PS Note:
Same rule probably should be applied to select element in jQuery Mobile Framework

[javascript]
$(‘.province_select’).attr(‘name’,'bill_province_2′).selectmenu(‘refresh’,true);
[/javascript]

One more snippet regarding this matter

[javascript]
$(‘select#provinces’).val(‘somevalue’).selectmenu(‘refresh’);
[/javascript]

Javascript: function showTime()

[javascript]
function showTime(){

myDate = new Date();

// Get time parts

hours = myDate.getHours();

minutes = myDate.getMinutes();

seconds = myDate.getSeconds();

// Just to display the time in a nice format

if (hours < 10) hours = "0" + hours;

if (minutes < 10) minutes = "0" + minutes;

if (seconds < 10) seconds = "0" + seconds;

actualTime = hours+":"+minutes+":"+seconds;

}
[/javascript]

php Code to analyze – ini_set usage

php Code to Analyze

ini_set usage with “include_path”

[php]
if ( function_to_test($var ) ) ini_set("include_path", "/var/www/vhosts/test.com/httpdocs/moneris");
else ini_set("include_path", "/var/www/vhosts/test.com/httpdocs/moneris");

require "modules/mpgClasses.php";
include "modules/mpiClasses.php";
[/php]

JQuery Mobile Framework Connecting

JQuery Mobile Framework connecting
[javascript]
<link rel="stylesheet" href="mobile_css.min.css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc2/jquery.mobile.structure-1.0rc2.min.css" />

<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>

<script type="text/javascript" >
$(document).bind("mobileinit", function(){
$.mobile.ajaxEnabled = false;
});
</script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
[/javascript]