jquery - How to add data-dismiss inside button tag? -


<button aria-hidden="true">close</button> 

i have button tag in html. want add <data-dismiss="modal"> inside button tag jquery become <button data-dismiss="modal" aria-hidden="true">close</button> . there way it?

$('button').attr("data-dismiss","modal");   

.attr takes 2 parameters, attribute , value.


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -