I am trying to add a customized warning box in JavaScript. I have a sample code for a customized alert box in JavaScript but it displays a static message (which was given in the function), I dynamically want to change the title and message. Please show me that this is Where is the title and message parameter in the #alert_button
function?
/ * You can drag custom box * / $ (document) .ready (function () {$ ("# alert_button"). Click (function (e) {E.preventDefault (); / * is a jAlert function that will show custom alarms. There are two arguments in the argument that the first argument is content. });
jQuery data for any dome element Therefore, you can store
titles
and messages
on your button and reach your 'click' event (or any other) within the listener's function like this :
$ ("#lert_button"). Data ({title: 'some title', message: 'some messages'}); Click ($ ("# Alert_button") (function (e) {e.preventDefault (); / * jAlert function that will show custom alerts There are two arguments: The first argument is the content for the alert. The second warning is the title * / JLart ($ (e.target) .data () .title, $ (e.target) .data (). Message);});
Comments
Post a Comment