Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

How to Get On click Data id using getAttribute() method ?

In this tutorial I’m going to learn how to get onclick get data id using JavaScript get id of the element that has the onclick event.

javascript code

{
	data: null,
	render: function(data, type, row) {
			return `
	<div class="row">
		<div class="col-6">
			<button type="button"
					class="edits btn btn-primary"
					data-project-name="${data['project_name']}"
					data-id="${data['id']}">
				Start Wizard
			</button>
		</div>
	</div>`;
		}
		,
},
$(document).on('click', '.edits', function() {
                console.log('amit wizard click ho rha');
                var projectName = $(this).data('project-name');
                var projectId = $(this).data('id');
                console.log('Project Name:', projectName);
                console.log('Project ID:', projectId);
                // Now you can use the projectName and projectId variables as needed
                $('#get_project_name').val(projectName);
                $('#exampleModal_getting').modal('show');
            });
Hi I am Amit Kumar Thakur Experienced as s Software Developer with a demonstrated history of working in the information technology and services industry. Skilled in HTML, CSS, Bootstrap4, PHP, Laravel-9 , REST API,FB API,Google API, Youtube Api, Bitbucket,Github,Linux and jQuery. Strong engineering professional focused in Computer/Information Technology Administration and Management. Currently my profile is to Software Developer, analyze the requirement, creating frame for web application, coding and maintenance.

Related Posts

How to print Array data in console.log in laravel ?

In this tutorial im going to learn how to print how many data is coming in array. 1st step go to your blade page and put below…

How to Use jQuery to Validate an Empty Input Field in laravel ?

jQuery is still a strong and popular JavaScript library for processing user input and providing interactivity to online projects. It is the best option for implementing client-side…

How to change image on change in jQuery ?

In this tutorial we’re going to learn how to change image on change i have to use the change() event is attached to the imageList select element…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x