Hi
i want to create dynamic fields like (text fields, checkboxes etc) when user click on add more fields link.
I am try but cannot find solution.
please guide
Are you familiar with adding elements to the DOM using JavaScript?
JavaScript Examples
Yes i am familiar with DOM. I have found the solution
document.createElement() has solved my problem.
thanks
It depends on what you're trying to do (You didn't explain real well). There are many ways of manipulating form elements (if that's what you're talking about), including the event handlers onsubmit, onreset, onfocus, onblur, onchange, and for text input fields onkeydown, onkeyup, and onkeypress. You can use the HTML DOM to manipulate things like the HTML code inside a couple tags. I used this in my web scripting class to make a text field next to a password input to give the strength of the password:
For this I used an empty set of HTML tags:Code:function pswdStrength(){ var Length = document.getElementById('password1').value.length; var str = document.getElementById('strength'); if( Length < 5 ) str.innerHTML = "Password strength: weak"; else if( Length < 9 ) str.innerHTML = "Password strength: medium"; else str.innerHTML = "Password strength: strong"; }
There are many other neat things you can do with the HTML DOM.Code:<label for="password1">Password: </label> <input type="password" id="password1" name="password" width="15" maxlength="15" onkeypress="pswdStrength();" /> <span id="strength"></span>
Life's too short to be cool. Be a nerd.
Thanks a lot for guiding me and given some precious time of yours which is valuable more than money.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks