can i set the id of an element programatically, as in a dynamic setting of id of an element, during runtime of the webpage?
Consider this scenario –
<body id="body1">
Now, i want to set the id of this element “body” dynamically, using the value of a variable in the php code. Is this possible? something like –
<body id=" <?php echo $bodyID; ?> ">
I use php and jquery in the page; please let me know whether such dynamic id assignment is possible to the elements in the html.
thanks.
PHP is the background language, it’s what produces your HTML output. So basically, what ever you output from PHP eventually becomes your HTML, meaning yes you can use PHP variables as your elemnt-ID or anything else for that matter.
OR You can output all of the HTML using a single echo statement.
In conclusion, whatever is left after PHP is finished executing is your HTML code that the end users browser interprets… Hope this helps…