###前提・実現したいこと
あるjqueryファイルを別のJqueryファイルを読み込んだときに読み込ませたいのですがどのように書けばよいでしょうか?(オーバーライドにあたると思います。)
宜しくお願い致します。
###試したこと
$(document).ready( function(){
});
を試してみましたが、オーバーライドすることはありませんでした。
###ソースコード
【abcJs.phtml】
Jquery
1<script type="text/javascript" language="javascript"><!-- 2$(window).load(function() 3{ 4 <? /* 住所と物件名から基本情報を取得 */ ?> 5 $("#getSearchRent").click(function() 6 { 7 <? /* ダイアログを開く */ ?> 8 objSearchRentDialog = new ModalDialog({ 9 dialogId : 'searchRentDialog', 10 height: 480, 11 width: 985, 12 title: '物件を候補から取込みます', 13 }); 14 15 searchRentDialog = objSearchRentDialog.open(); 16 17 $("#searchRentDialog").html('検索中') 18 .dialog('open') 19 .load( 20 "<?= $searchAjax ?>", 21 { 22 classcode : '<?= $rentClass ?>', 23 name : $("#realEstateName1").val(), 24 spare : $("#spareDetail").val(), 25 code1 : $("#todofukenCode").val(), 26 code2 : $("#shikuchosonCode").val(), 27 code3 : $("#oazaTsushoCode").val(), 28 code4 : $("#azaChomokuCode").val(), 29 <? if($this->kanriFlg): ?> 30 kanriFlg : 1, 31 <? endif; ?> 32 firstTime : 1 33 } 34 ); 35 }); 36}); 37 // --> 38</script>
【defeJs.phtml】
<?=$this->render('/search/abcJs.phtml'); ?> <script type="text/javascript" language="javascript"><!-- $(window).load(function() { //フリガナ自動入力 Name = ''; NameKana = ''; $('input#Name').katakanaAutoComplete($('input#NameKana'), Name, NameKana); });
ghiJs.phtml
<script type="text/javascript" language="javascript"> $(function(){ $("#Time").on('change keyup',function(){ var time = $(this).val(); if(time === ""){ $(this).next('span').next('input[type="text"]').val(''); } else { $(this).next('span').next('input[type="text"]').val(time * 50); } }); }); </script>
HTML
<div class="ttl_bt_box"> <button type="button" id="getSearchRent">検索ダイアログ </button> </div> <table> <tr> <th> 名前 </th> <td> <?= $this->form->Name ?> <?= $this->error($this->form->Name) ?> </td> </tr> <tr> <th> フリガナ </th> <td> <?= $this->form->NameKana ?> <?= $this->error($this->form->NameKana) ?> </td> </tr> </table> <table> <tr> <th> 時間・距離 </th> <td> <span id="Time"> <?= $this->form->Time ?>分・ <?= $this->form->Distance ?>m </span> <?= $this->error($this->form->Time) ?> <?= $this->error($this->form->Distance) ?> </td> </tr> </table>
※ソースコードを追記しました。
回答1件
あなたの回答
tips
プレビュー