Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change div id using jquery

How to change the id of the div using jquery?

I have div with id (initially as 'first') and a dropdown (with values 'first', 'second').

On changing the dropdown value, i need to change the id of the div according to dropdown value.

like image 597
Prasad Avatar asked Dec 01 '22 11:12

Prasad


1 Answers

It is simple:

$('#first').attr('id', 'second');

Add it to your onchange function.

like image 80
Arkadiusz Kondas Avatar answered Dec 04 '22 11:12

Arkadiusz Kondas