跳至主要内容

博文

目前显示的是标签为“jquery”的博文

jquery file upload with symfony2

for use this plugin, install jquery-file-upload in web install punk_ave bundle and this is my example: /** * @Route("/import",name="prospection_admin_import") * @Template() */ public function importAction(){ $fileUploader = $this->get('punk_ave.file_uploader'); $request = $this->getRequest(); $existingFiles=null; $editId = $request->query->get('editId'); if (!$editId){ $editId=$request->getSession()->get('editId'); } if ($editId){ $existingFiles = $fileUploader->getFiles(array('folder' => '/tmp/attachments/'. $editId)); if ($request->getMethod() == 'POST') { $type=$request->request->get("importType"); $importHandler=$this->get('addepi.prospection.import.handler'); $path=$this->get('kernel')->getRootDir()."/../web/uploads/tmp/attachments/".$editId."/originals/"; f...

jquery how to hide the select arrow when the ajax return only one option

well, just note it for memo. html: less: /* Select arrow styling */ .address_city_chooser{ >div{ position:relative; display:inline-block; &.disabled{ label:after{ content: ''; width: 23px; height: 23px; position: absolute; display: inline-block; top: 4px; right: 4px; background: #fff; pointer-events: none; } } } } and js: $.get( Routing.generate('prospection_public_city',{'postCode':code,'_locale':currentLang}), function(response){ if(typeof response.error!="undefined"){ $('#errorDialog').html(response.error); $('#errorDialog').dialog('open'); }else{ $(container).html(response); if ($(container).find('option').length

jquery validation, how to check a select box is not the default value

1. You can write your own rule! // add the rule here $ . validator . addMethod ( "valueNotEquals" , function ( value , element , arg ){ return arg != value ; }, "Value must not equal arg." ); // configure your validation $ ( "form" ). validate ({ rules : { SelectName : { valueNotEquals : "default" } }, messages : { SelectName : { valueNotEquals : "Please select an item!" } } }); 2. An easier solution has been outlined here:  [jQuery] Validate select box Make the value be empty and add the required attribute id = "select" class = "required" > value = "" > Choose an option value = "option1" > Option1 value = "option2" > Option2 value = "option3" > Option3

jquery change the select box value

we can do this at first: $("#simple_search_bar .cat option[value=0]").prop('selected',true); and there is an article talke about this: The right way to do this depends upon your circumstances. Case 1: No  value  attributes on the  option  elements If your  option  elements don't have  value  attributes  (and you're not worried about the possibility of somebody adding them later and inadvertently breaking your existing code),  then  just use the  .val() method  of the jQuery object wrapping your  select  element. For instance, in the OP's case... $select = $ ( '#cbCategory' ); $select . val ( cat ); // Selects the option with text `cat`, as long as the options don't have // 'value' attributes. Case 2:  Option  elements have  value  attributes If your  option  elements have value attributes (or  value  attributes might be added in the f...

how to set jquery datatable cloumn width combine with a text-overflow.

If you wanna to cut the text in a column  some thing like: td{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } Then you must set the table as </> table.dataTable { table-layout: fixed; } And if you set table-layout:fixed, you can never use "aoColumns": [ { "sWidth": "20%" }, { "sWidth": "15%" }, { "sWidth": "20%" }, { "sWidth": "15%" }, { "sWidth": "5%" }, { "sWidth": "5%" }, { "sWidth": "10%" }, { "sWidth": "5%" }, { "sWidth": "5%"} ] Because this is a dynamic setting for th,So you need add somthing like this:      <colgroup>         <col style="width:10%">         <col style="width:20%">                 <col style="width:15%">         <col style="width:10%">   ...

how to use viriable text for dialog buttion of jquery ui

Referring to  http://jqueryui.com/demos/dialog/  you can see there are 2 alternate ways of defining the buttons, one is what you are using here, the second is using arrays. var button1 = 'Ok' ; var button2 = 'Not Ok' ; $ ( ".selector" ). dialog ({ buttons : [ { text : button1 , click : function () { $ ( this ). dialog ( "close" ); } }, { text : button2 , click : function () { $ ( this ). dialog ( 'close' ); } } ] });

how to add a customized jquery ui button

. ui-button . ui-icon . you-own-cusom-class { background-image : url ( your-path-to-normal-image-file.png ); width : your-icon-width ; height : your-icon-height ; } . ui-button . ui-state-hover . ui-icon . you-own-cusom-class { background-image : url ( your-path-to-highlighted-image-file.png ); width : your-icon-width ; height : your-icon-height ; } then just type in the JS code: jQuery ( 'selector-to-your-button' ). button ({ text : false , icons : { primary : "you-own-cusom-class" // Custom icon }});