LoginSignup
0
0

いつか使えるかも

Last updated at Posted at 2024-02-08

コード


echo div('class="my-div"', 'This is my div content.');


$this->load->library('javascript/jquery');
$this->jquery->event('#myButton','click', '$("#myElement").hide();');



結果



イベントは、blur、change、click、dblclick、error、focus、hover、keydown、keyup、load、mousedown、mouseup、mouseover、mouseup、resize、scroll、またはunloadのいずれかです。
element_pathは、有効なjQueryセレクターです。jQueryのユニークなセレクター構文のため、これは通常、要素のidまたはCSSセレクターです。例えば、#notice_areaは

に影響を与え、#content a.noticeはidがcontentのdiv内のすべてのnoticeクラスを持つアンカーに影響を与えます。
code_to_run()は、自分で書いたスクリプト、または下記のjQueryライブラリからのエフェクトなどのアクションです。

https://codeigniter.jp/user_guide/3/libraries/javascript.html#hide-show

関数内でasyncキーワードを使用し、awaitを使って非同期処理が完了するまで待ちます。

async function fetchData() {
    const data = await doAjax('deck_tool_get_type_list', {'select_id': select_id});
    window.aaa = data.send_data['bbb'];
    console.log(window.aaa);
}

fetchData();

async function fetchData() {
    const data = await doAjax('deck_tool_get_type_list', {'select_id': select_id});
    window.aaa = data.send_data['bbb'];
    console.log(window.aaa);
}

fetchData();

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0