/** * Enable a link_button or button * @param String $selector The jQuery Selector * @param String $funtion The function to bind. Needed to enable a link_button * @param boolean $isInternal */ function ui_enable_button($selector, $funtion = '', $isInternal = true) { if (!function_exists('ui_effects')) { use_helper('ysJQueryUIEffects'); } $sintax = ''; $sintax = jquery_set($selector, 'attr', array('disabled' => ''), $unescapeId = true, $accesors = '', $addSeparator = true); if ($funtion != '') { $sintax = jquery_bind_event($selector, 'click', $funtion); } $sintax .= ui_effects_remove_class($selector, array('class' => 'ui-state-disabled')); $sintax .= ui_effects_add_class($selector, array('class' => 'ui-state-default')); if ($isInternal) { return $sintax; } else { return add_jquery_support($selector, 'ready', like_function($sintax)); } }
<br> <br> <hr> <h3>Get and Set attributes - example</h3> <input type="text" id="txtTo"> <input type="text" id="txtFrom"> <?php echo add_jquery_support('#txtTo', 'keyup', like_function(jquery_set('#txtFrom', 'val', jquery_get('#txtTo', 'val')))); ?> <br> <hr> <h3>Set attributes (array) - example</h3> <input type="button" value="Set Attributes" id="btnAddAttr"> <img id="imgToSet" alt="" src=""/> <?php echo add_jquery_support('#btnAddAttr', 'click', like_function(jquery_set('#imgToSet', 'attr', array('src' => "http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif", 'title' => "jQuery (Connect to internet to see the image)", 'style' => 'background-color:black', 'alt' => "jQuery Logo")))); ?> <br> <hr> <h3>DoubleClick- example</h3> <input type="button" value="DoubleClick me" id="btnDblClick"> <?php echo add_jquery_support('#btnDblClick', 'dblclick', like_function("alert('Succes')")); ?> <br> <hr> <h3>Mouseover - Mouseout example</h3>