Archive for March, 2013

Change options of jqTransform select tag

March 10th, 2013 1 comment

jqTransform is a plugin for jQuery which allows you to further stylize your form. If the forms are static, everything works as it should, you can even implement plugins for validation. If you need to change the contents of a list of select tag, there is a problem. Changing the list is not done in a changed its visual appearance. The reason is that the change list, but it is hidden and you need to somehow communicate jqTransform addition to want to reload.

For this purpose, use the jqTransSelect(), but before that it neet do comment one line in the plugin. Within the plugin, locate and comment line

if($select.hasClass('jqTransformHidden')) {return;}

Then, refresh the list storing the code in your javascript:

$('#selectID').jqTransSelect(); // selectID is ID of select tag

Here’s some more detailed examples of how all this could be done.

<script language="javascript">
function setPersons()
   var persons = $('#personen').val();
   var data = $('#sessie').val();
   data = data.split('-');
   var selectList = "<option value=''>Select element</option>";
   for (var i=1; i <= 5; i++)
       selectList += "<option value='" + i + "'>" + i + "</option>";

javascript in_array()

March 10th, 2013 No comments

For those who use the PHP function in_array () here’s how to create this functionality in JavaScript:

Array.prototype.in_array = function(p_val) 
  for(var i = 0, l = this.length; i < l; i++) {
    if(this[i] == p_val) return true;
  return false;

// example
var v_array = [ 5, 10, 15, 20, 25];
document.writeln(v_array.in_array(10)); // will return 

For details go to original location

Categories: JavaScript Tags: , ,

(srpski) 10 saveta za optimizaciju PHP koda

March 10th, 2013 No comments

Sorry, this entry is only available in Serbian.

Categories: PHP Tags: ,