How to pass the value entered by the user in div contentable="true"

Asked 2 months ago, Updated 2 months ago, 3 views

Please let me know as it doesn't work.

First, ask the user to enter characters and images within this frame.

<div id="editor" contentable="true"></div>

Trigger user to press this button after typing

<input type="buttun" onclick="add()">

Run jQuery to

function add(){
variable editor=$("#editor").val();
$.mobile.changePage($("#list-page"));
$("#list").append("<li>"+"<p>"+editor+"</p>/li>")
$("#list").listview('refresh');
};

Reflect user input in the list view below

<div data-role="page"id="list-page">
<ul data-role="listview" data-inset="true" id="list"></ul>
</div>

I'd like to do this, but even if I press the button, I can't move on.
Is there anything wrong with the code above?

jquery html5

2022-09-30 14:15

1 Answers

The jQuery reference does not state that div can use .val().You probably need to use .html().


2022-09-30 14:15

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.