Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 995433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:43:19+00:00 2026-05-16T06:43:19+00:00

I am trying to write a simple Javascript snippet into a Codeigniter link. I

  • 0

I am trying to write a simple Javascript snippet into a Codeigniter link. I am using the link to delete posts where required in my dashboard. I dont know anything about JS although am trying to learn it.

Code

$js = 'onClick = "alert("Are you sure")"';

$this->table->set_heading('Date', 'Title', 'Delete', 'Update');

foreach($records as $row){
$row->title = ucwords($row->title);
$this->table->add_row($row->date,
$row->title = ucwords($row->title),    
anchor("main/delete/$row->id", $row->id, $js), //this is the link in question
anchor("main/fill_form/$row->id", $row->id)
);
}
$table = $this->table->generate();
echo $table;

My question is how to write the JS for the link ($js). I would like to use a confirm statement, (yes or no). I am totally lost with JS to prevent accidental deletions

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:43:19+00:00Added an answer on May 16, 2026 at 6:43 am

    Here’s how you might do it with the CodeIgniter anchor function :

    echo anchor('delete/something', 'Delete', array('onClick' => "return confirm('Are you sure you want to delete?')"));
    

    This displays a confirmation box when the link is clicked. If the user confirms then the link is followed. If the user cancels then no action is taken.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a simple javascript, or so I think, using while loops,
I'm trying to write a simple client-side text editor using HTML5 and Javascript. Is
I am trying to write a simple script in JavaScript, just for testing purposes.
I'm trying to do a simple write to database with an HTML form, using
I'm trying to write a simple search server, using Django with AJAX. The server
I am trying to write a simple if statement in javascript (jquery library) that
I am trying to write a simple JavaScript page timer for a web app.
I'm trying to write a simple Javascript(jQuery) function that randomly displays 6 Divs out
I'm trying to write some simple chat client in javascript, but I need a
I am trying to write a simple decrypt function in JavaScript that would take

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.